diff --git a/.env.dev b/.env.dev index e53dd47e..aeb2104b 100644 --- a/.env.dev +++ b/.env.dev @@ -13,8 +13,8 @@ VUE_APP_TITLE = 智能监控分析系统 # 芋道管理系统/开发环境 # VUE_APP_BASE_API = 'http://172.16.33.187:48082' -# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com' -VUE_APP_BASE_API = 'http://172.16.32.79:48082' +VUE_APP_BASE_API = 'http://line.kszny.picaiba.com' +# VUE_APP_BASE_API = 'http://172.16.32.79:48082' # 路由懒加载 diff --git a/src/api/base/equipment.js b/src/api/base/equipment.js index 3239772a..7c4183aa 100644 --- a/src/api/base/equipment.js +++ b/src/api/base/equipment.js @@ -62,10 +62,10 @@ export function getEquipmentAll() { export function getTree(query) { return request({ - url: '/base/factory/getTree', - method: 'get', - params: query - }) + url: '/base/factory/getTreeSimple', + method: 'get', + params: query, + }); } export function getEquipmentOverall(data) { diff --git a/src/components/ButtonNav/index.vue b/src/components/ButtonNav/index.vue index dfbcc0f1..dedc0dca 100644 --- a/src/components/ButtonNav/index.vue +++ b/src/components/ButtonNav/index.vue @@ -54,7 +54,7 @@ export default { }; }, created() { - this.currentMenu = this.menus[0]; + // this.currentMenu = this.menus[0]; }, watch: { currentMenu(val) { diff --git a/src/views/base/materialPricing/add-or-updata.vue b/src/views/base/materialPricing/add-or-updata.vue index 5b2b92d6..3ae1f008 100644 --- a/src/views/base/materialPricing/add-or-updata.vue +++ b/src/views/base/materialPricing/add-or-updata.vue @@ -63,7 +63,7 @@ style="width: 75%" v-model="dataForm.price" clearable - placeholder="请输入允许留存时间" /> + placeholder="请输入单价" /> {{ unit }} @@ -140,13 +140,15 @@ export default { setTimeout(this.setCode(), 1000); } }, - setCode() { + setCode() { + console.log('this.MaterialList', this.urlOptions.dictArr.dict0); + this.MaterialList.forEach((item) => { if (item.id === this.dataForm.materialId) { this.dataForm.code = item.code; this.unit = '元/' + - this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit) + this.urlOptions.dictArr.dict0.find((d) => d.value == item.unit) .label; } }); diff --git a/src/views/core/analysis/balanceAnalysis/eq-detail.vue b/src/views/core/analysis/balanceAnalysis/eq-detail.vue index 916542cf..aaecd060 100644 --- a/src/views/core/analysis/balanceAnalysis/eq-detail.vue +++ b/src/views/core/analysis/balanceAnalysis/eq-detail.vue @@ -128,7 +128,7 @@ export default { this.tableData = response.data; this.dataListLoading = false; }); - }, + }, handleClick(val) { const data = { ...this.time, diff --git a/src/views/core/analysis/yieldAnalysis/index.vue b/src/views/core/analysis/yieldAnalysis/index.vue index f258c945..fe0c8f5c 100644 --- a/src/views/core/analysis/yieldAnalysis/index.vue +++ b/src/views/core/analysis/yieldAnalysis/index.vue @@ -90,6 +90,7 @@ export default { param: 'lineIds', defaultSelect: [], multiple: true, + collapseTags: true, filterable: true, width: 300, }, diff --git a/src/views/core/base/product/add-or-updata.vue b/src/views/core/base/product/add-or-updata.vue index 85dbb17f..acead6fb 100644 --- a/src/views/core/base/product/add-or-updata.vue +++ b/src/views/core/base/product/add-or-updata.vue @@ -80,6 +80,16 @@ + + + + + + + + + @@ -131,160 +141,184 @@ diff --git a/src/views/core/base/productionLine/index.vue b/src/views/core/base/productionLine/index.vue index e1245921..62abac63 100644 --- a/src/views/core/base/productionLine/index.vue +++ b/src/views/core/base/productionLine/index.vue @@ -104,7 +104,11 @@ export default { getDataListURL: getProductionLinePage, deleteURL: deleteProductionLine, exportURL: exportProductionLineExcel, - }, + }, + listQuery: { + pageSize: 20, + pageNo:1 + }, tableProps, tableBtn: [ this.$auth.hasPermi(`base:production-line:update`) @@ -212,7 +216,7 @@ export default { switch (val.btnName) { case 'search': this.listQuery.pageNo = 1; - this.listQuery.pageSize = 10; + this.listQuery.pageSize = 20; this.listQuery.factoryId = val.factoryId || undefined; this.listQuery.name = val.name; this.getDataList(); @@ -220,7 +224,7 @@ export default { case 'reset': this.$refs.searchBarForm.resetForm(); this.listQuery = { - pageSize: 10, + pageSize: 20, pageNo: 1, total: 1, }; diff --git a/src/views/core/monitoring/lineAuto/index.vue b/src/views/core/monitoring/lineAuto/index.vue index c1e70c1c..fc6caf4c 100644 --- a/src/views/core/monitoring/lineAuto/index.vue +++ b/src/views/core/monitoring/lineAuto/index.vue @@ -519,6 +519,12 @@ export default { btnName: '重置', name: 'reset', }, + // { + // type: 'label', // 初始隐藏 + // label: '刷新时间', // 自定义标识 + // // slot: 'currentTimeSlot', // 自定义插槽名 + // // width: 200, // 宽度适配 + // }, ] }; }, @@ -541,7 +547,7 @@ export default { { prop: 'processType', label: '产品类型', - filter: (val) => (val != 1 ? '面板' : '背板'), + filter: (val) => (val === 1 ? '面板' : '背板'), fixed: true, sortable: true, }, @@ -588,12 +594,12 @@ export default { // end.getTime() // ]; - this.$refs.searchBarForm.formInline.timeType = 1 - + this.$refs.searchBarForm.formInline.timeType = 3 } + }); - this.getDayDataList(); + // this.getLastDayDataList(); this.getPdLineList(); const queryParams = { pageNo: 1, @@ -642,6 +648,12 @@ export default { this.formConfig[1].type = ''; // 隐藏查询类型 this.formConfig[6].type = ''; // 隐藏报表类型 this.formConfig[7].type = ''; // 隐藏时间范围 + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1); + } }; // 3. 执行公共重置 @@ -656,14 +668,43 @@ export default { this.formConfig[3].type = 'select'; // 显示产线 this.formConfig[4].type = ''; // 隐藏产品工艺 this.formConfig[5].type = ''; // 隐藏产品类型 - this.getDayDataList(); - + this.listQuery.timeType = 3; + if (this.$refs.searchBarForm) { + this.$refs.searchBarForm.formInline.timeType = 3; + } + // 主动调用上一班数据接口 + this.getLastDayDataList(); + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } } else { + // 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班 this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班 this.formConfig[3].type = ''; // 隐藏产线 this.formConfig[4].type = 'select'; // 显示产品工艺 this.formConfig[5].type = 'select'; // 显示产品类型 + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } this.getProductList(); } @@ -995,6 +1036,26 @@ export default { } switch (val.btnName) { case 'search': + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + + // 仅当时间维度为【当天】时,添加/更新刷新时间 + if (this.listQuery.timeType === 1 || this.listQuery.timeType === 3) { + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } + } else if (timeItemIndex > -1) { + // 非当天时,移除刷新时间 + this.formConfig.splice(timeItemIndex, 1); + } + if (this.activeName === 'productLine') { if (this.listQuery.timeType === 1) { this.getDayDataList(); @@ -1012,7 +1073,7 @@ export default { break; case 'reset': this.$refs.searchBarForm.resetForm(); - this.$refs.searchBarForm.formInline.timeType = 1; + this.$refs.searchBarForm.formInline.timeType = 3; this.formConfig[0].selectOptions = this.activeName === 'productLine' ? this.timeTypeOptions.productLine : this.timeTypeOptions.product; @@ -1020,10 +1081,23 @@ export default { pageSize: 100, pageNo: 1, total: 0, - timeType: 1, + timeType: this.activeName === 'productLine' ? 3 : 1, }; + // 重置后默认是当天,添加刷新时间 + const resetTimeIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const resetTimeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (resetTimeIndex > -1) { + this.formConfig.splice(resetTimeIndex, 1, resetTimeLabel); + } else { + this.formConfig.push(resetTimeLabel); + } if (this.activeName === 'productLine') { - this.getDayDataList(); + this.getLastDayDataList(); } else { this.getProductList(); } @@ -1350,29 +1424,48 @@ export default { this.listQuery.pageNo = val; this.getDataList(); }, - + formatCurrentTime() { + const date = new Date(); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${hours}:${minutes}:${seconds} ${year}.${month}.${day}`; + }, // 搜索栏下拉选择变化 handleSearchBarChanged({ param, value }) { if (param === 'timeType') { - console.log(value); - this.listQuery.timeType = value; - if (value === 2) { - // 切换为“自定义”:显示查询类型和时间范围 + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + + // 仅移除,不添加(查询时才添加) + if (value !== 1 && value !== 3 && timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1); + } + + this.$refs.searchBarForm.formInline.timeType = value; + this.$refs.searchBarForm.formInline.searchType = undefined; + this.$refs.searchBarForm.formInline.reportType = undefined; + this.$refs.searchBarForm.formInline.timeVal = undefined; + + if (value === 1) { + this.formConfig[1].type = ''; + this.formConfig[6].type = ''; + this.formConfig[7].type = ''; + } else if (value === 2) { this.formConfig[1].type = 'select'; - this.$refs.searchBarForm.formInline.timeType = value; - this.listQuery.timeType = value; + this.$refs.searchBarForm.formInline.searchType = 1; this.formConfig[7].type = 'datePicker'; } else { this.formConfig[1].type = ''; this.formConfig[6].type = ''; this.formConfig[7].type = ''; - this.$refs.searchBarForm.formInline.timeType = value; - this.listQuery.timeType = value; - this.$refs.searchBarForm.formInline.searchType = undefined; - this.$refs.searchBarForm.formInline.reportType = undefined; - this.$refs.searchBarForm.formInline.timeVal = undefined; } + } else if (param === 'searchType') { if (value === 1) { // 统计数据:显示时间范围,隐藏报表类型 @@ -1422,7 +1515,10 @@ export default { label: '时间范围', dateType: 'week', placeholder: '选择日期', - format: 'yyyy-MM-dd', + format: 'yyyy 第 WW 周', + pickerOptions: { + firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推) + }, valueFormat: 'yyyy-MM-dd', param: 'timeValWeek', width: 250, diff --git a/src/views/core/monitoring/nextClip/hisData.vue b/src/views/core/monitoring/nextClip/hisData.vue index 87105ed6..3989f2d7 100644 --- a/src/views/core/monitoring/nextClip/hisData.vue +++ b/src/views/core/monitoring/nextClip/hisData.vue @@ -204,94 +204,88 @@ export default { ); }); }, - test() { - var target = document.getElementsByClassName("right-aside")[0] - target.style.background = '#FFFFFF' - var that = this - setTimeout(() => { - html2canvas(target).then(function(canvas) { - var contentWidth = canvas.width - var contentHeight = canvas.height - - // 一页pdf显示html页面生成的canvas高度 - var pageHeight = contentHeight / 592.28 * 841.89 - // 未生成pdf的html页面高度 - var leftHeight = contentHeight - // 页面偏移 - var position = 0 - // a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的高度 - var imgWidth = 595.28 - var imgHeight = 592.28 / contentWidth * contentHeight - - var pageData = canvas.toDataURL('image/jpeg', 1.0) - - console.log('nihc URL', leftHeight, pageHeight) - - var pdf = new jsPDF('', 'pt', 'a4') - - if (leftHeight < pageHeight) { - pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight) - } else { - while(leftHeight > 0) { - pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight) - leftHeight -= pageHeight - position -= 841.89 - // 避免空白页 - if (leftHeight > 0) { - pdf.addPage() - } - } - } - - pdf.save(that.fileName + '工段统计.pdf') - }) - }, 300) - }, - exportECL() { - let tables = document.querySelector('.el-table').cloneNode(true) - const fix = tables.querySelector('.el-table__fixed') - const fixRight = tables.querySelector('.el-table__fixed-right') - if (fix) { - tables.removeChild(tables.querySelector('.el-table__fixed')) - } - if (fixRight) { - tables.removeChild(tables.querySelector('.el-table__fixed-right')) - } - let exportTable = XLSX.utils.table_to_book(tables) - - var exportTableOut = XLSX.write(exportTable, { - bookType: 'xlsx', bookSST: true, type: 'array' - }) - // sheetjs.xlsx为导出表格的标题名称 - try { - FileSaver.saveAs(new Blob([exportTableOut], { - type: 'application/octet-stream' - }), this.fileName + '工段统计.xlsx') - } catch (e) { - if (typeof console !== 'undefined') console.log(e, exportTableOut) + exportXlsx() { + if (!this.showData.length) { + this.$message.warning('暂无数据可导出'); + return; } - return exportTableOut - }, - exportPdf() { - this.test() - setTimeout(() =>{ - this.dialogVisible = false - this.showData = this.tableData - }, 600) - }, - exportXlsx() { - this.exportECL() - this.dialogVisible = false - this.showData = this.tableData - }, - handleClose(done) { - this.$confirm('确认关闭?') - .then(_ => { - done(); - }) - .catch(_ => {}); - }, + this.exportLoading = true; + + try { + // 1. 处理导出数据(格式化时间字段) + const exportData = this.showData.map(item => { + const formatItem = { ...item }; + // 格式化时间字段 + if (formatItem.startTime) formatItem.startTime = parseTime(formatItem.startTime); + if (formatItem.endTime) formatItem.endTime = parseTime(formatItem.endTime); + return formatItem; + }); + + // 2. 构建表头映射:{ prop: label },只保留表格配置中存在的列 + const headerMap = {}; + this.tableProps.forEach(col => { + if (col.prop && col.label) { + headerMap[col.prop] = col.label; + } + }); + + // 3. 转换数据:将prop键名替换为label,按tableProps顺序排列列 + const formattedData = exportData.map(item => { + const newItem = {}; + // 按表格配置顺序遍历列,确保Excel列顺序与表格一致 + this.tableProps.forEach(col => { + const prop = col.prop; + const label = col.label; + if (prop && label) { + // 处理可能的undefined值,避免导出为空字符串 + newItem[label] = item[prop] ?? ''; + } + }); + return newItem; + }); + + // 4. 创建工作表(使用处理后的带label表头的数据) + const worksheet = XLSX.utils.json_to_sheet(formattedData); + + // 5. 创建工作簿并添加工作表 + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, '下片日志数据'); + + // 6. 生成Excel文件 + const excelBuffer = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array' + }); + + // 7. 保存文件 + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' + }); + + // 8. 生成文件名(包含查询条件信息) + let fileName = '下片历史'; + if (this.listQuery.productionLineId) { + const lineItem = this.formConfig[0].selectOptions.find( + item => item.id === this.listQuery.productionLineId + ); + if (lineItem) fileName += lineItem.name + '_'; + } + if (this.listQuery.thick) { + fileName += this.listQuery.thick + '_'; + } + // 添加时间戳避免文件名重复 + fileName += + '.xlsx'; + + FileSaver.saveAs(blob, fileName); + this.$message.success('导出成功'); + } catch (error) { + console.error('导出失败:', error); + this.$message.error('导出失败,请重试'); + } finally { + this.exportLoading = false; + } + }, getPdLineList() { getPdList().then((res) => { this.formConfig[0].selectOptions = res.data || [] @@ -323,7 +317,7 @@ export default { this.getDataList(); break; case 'export': - this.handleExport(); + this.exportXlsx(); break; default: console.log(val); @@ -351,12 +345,6 @@ export default { this.listQuery.pageNo = val; this.getDataList(); }, - handleExport() { - if (this.selectedList.length > 0) { - this.showData = this.selectedList - } - this.dialogVisible = true - } }, }; diff --git a/src/views/core/monitoring/productAuto/index.vue b/src/views/core/monitoring/productAuto/index.vue index c916ce73..d935a995 100644 --- a/src/views/core/monitoring/productAuto/index.vue +++ b/src/views/core/monitoring/productAuto/index.vue @@ -570,22 +570,35 @@ export default { }, mounted() { this.$nextTick(() => { + // 1. 强制设置当前激活标签为 按产品监控 + this.activeName = 'product'; if (this.$refs.buttonNav) { this.$refs.buttonNav.currentMenu = '按产品监控'; + // 时间维度选项只显示 当天/自定义(无 上一班) this.formConfig[0].selectOptions = this.timeTypeOptions.product; } if (this.$refs.searchBarForm) { - // this.$refs.searchBarForm.formInline.timeVal = [ - // yesterday.getTime(), - // end.getTime() - // ]; - - this.$refs.searchBarForm.formInline.timeType = 1 - + // 2. 强制设置搜索表单的 timeType 为 1(当天) + this.$refs.searchBarForm.formInline.timeType = 1; + // 同步查询参数的 timeType + this.listQuery.timeType = 1; + } + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); } }); - this.getDayDataList(); + // 3. 初始化直接调用 按产品监控 的接口 + this.getProductList(); this.getPdLineList(); const queryParams = { pageNo: 1, @@ -597,11 +610,22 @@ export default { }); }, methods: { + formatCurrentTime() { + const date = new Date(); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${hours}:${minutes}:${seconds} ${year}.${month}.${day}`; + }, // 切换按产线/按产品监控 currentMenu(val) { // 1. 确定当前激活的类型(产线/产品) const isProductLine = val === '按产线监控'; this.activeName = isProductLine ? 'productLine' : 'product'; + console.log('isProductLine', isProductLine); // 2. 提取公共重置逻辑(无论切换到哪个标签,都需要执行的操作) const resetCommon = () => { @@ -634,11 +658,19 @@ export default { this.formConfig[1].type = ''; // 隐藏查询类型 this.formConfig[6].type = ''; // 隐藏报表类型 this.formConfig[7].type = ''; // 隐藏时间范围 + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1); + } }; // 3. 执行公共重置 resetCommon(); - + // if (this.activeName === 'productLine') { + // } else { + // } // 4. 根据类型设置差异化的表单配置(仅处理不同的部分) if (isProductLine) { // 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班 @@ -646,16 +678,44 @@ export default { this.formConfig[3].type = 'select'; // 显示产线 this.formConfig[4].type = ''; // 隐藏产品工艺 this.formConfig[5].type = ''; // 隐藏产品类型 - this.getDayDataList(); + this.listQuery.timeType = 3; + if (this.$refs.searchBarForm) { + this.$refs.searchBarForm.formInline.timeType = 3; + } + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } + // 主动调用上一班数据接口 + this.getLastDayDataList(); } else { + this.getProductList(); + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } // 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班 this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班 this.formConfig[3].type = ''; // 隐藏产线 this.formConfig[4].type = 'select'; // 显示产品工艺 this.formConfig[5].type = 'select'; // 显示产品类型 - this.getProductList(); - } }, @@ -947,6 +1007,25 @@ export default { } switch (val.btnName) { case 'search': + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + + // 仅当时间维度为【当天】时,添加/更新刷新时间 + if (this.listQuery.timeType === 1 || this.listQuery.timeType === 3) { + const timeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1, timeLabel); + } else { + this.formConfig.push(timeLabel); + } + } else if (timeItemIndex > -1) { + // 非当天时,移除刷新时间 + this.formConfig.splice(timeItemIndex, 1); + } if (this.activeName === 'productLine') { if (this.listQuery.timeType === 1) { this.getDayDataList(); @@ -965,15 +1044,27 @@ export default { case 'reset': this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.formInline.timeType = 1; - this.formConfig[0].selectOptions = this.activeName === 'productLine' + this.formConfig[0].selectOptions = this.activeName === 'product' ? this.timeTypeOptions.productLine : this.timeTypeOptions.product; this.listQuery = { pageSize: 100, pageNo: 1, total: 0, - timeType: 1, + timeType: this.activeName === 'productLine' ? 3 : 1, }; + const resetTimeIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + const resetTimeLabel = { + type: 'label', + label: `刷新时间: ${this.formatCurrentTime()}`, + }; + if (resetTimeIndex > -1) { + this.formConfig.splice(resetTimeIndex, 1, resetTimeLabel); + } else { + this.formConfig.push(resetTimeLabel); + } if (this.activeName === 'productLine') { this.getDayDataList(); } else { @@ -1307,24 +1398,33 @@ export default { handleSearchBarChanged({ param, value }) { console.log(value, param); if (param === 'timeType') { - console.log(value); - this.listQuery.timeType = value; - if (value === 2) { - // 切换为“自定义”:显示查询类型和时间范围 + const timeItemIndex = this.formConfig.findIndex(item => + item.label?.includes('刷新时间') + ); + + // 仅移除,不添加(查询时才添加) + if (value !== 1 && value !== 3 && timeItemIndex > -1) { + this.formConfig.splice(timeItemIndex, 1); + } + + this.$refs.searchBarForm.formInline.timeType = value; + this.$refs.searchBarForm.formInline.searchType = undefined; + this.$refs.searchBarForm.formInline.reportType = undefined; + this.$refs.searchBarForm.formInline.timeVal = undefined; + + if (value === 1) { + this.formConfig[1].type = ''; + this.formConfig[6].type = ''; + this.formConfig[7].type = ''; + } else if (value === 2) { this.formConfig[1].type = 'select'; - this.$refs.searchBarForm.formInline.timeType = value; - this.listQuery.timeType = value; + this.$refs.searchBarForm.formInline.searchType = 1; this.formConfig[7].type = 'datePicker'; } else { this.formConfig[1].type = ''; this.formConfig[6].type = ''; this.formConfig[7].type = ''; - this.$refs.searchBarForm.formInline.timeType = value; - this.listQuery.timeType = value; - this.$refs.searchBarForm.formInline.searchType = undefined; - this.$refs.searchBarForm.formInline.reportType = undefined; - this.$refs.searchBarForm.formInline.timeVal = undefined; } } else if (param === 'searchType') { if (value === 1) { @@ -1375,7 +1475,10 @@ export default { label: '时间范围', dateType: 'week', placeholder: '选择日期', - format: 'yyyy-MM-dd', + format: 'yyyy 第 WW 周', + pickerOptions: { + firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推) + }, valueFormat: 'yyyy-MM-dd', param: 'timeValWeek', width: 250, diff --git a/src/views/core/monitoring/rawFilmReport/index.vue b/src/views/core/monitoring/rawFilmReport/index.vue index 33798e93..6e4a5b19 100644 --- a/src/views/core/monitoring/rawFilmReport/index.vue +++ b/src/views/core/monitoring/rawFilmReport/index.vue @@ -244,7 +244,10 @@ export default { label: '统计时间', dateType: 'week', placeholder: '选择日期', - format: 'yyyy-MM-dd', + format: 'yyyy 第 WW 周', + pickerOptions: { + firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推) + }, valueFormat: 'yyyy-MM-dd', param: 'timeValWeek', width: 250, @@ -453,11 +456,10 @@ export default { item.statisticType = this.listQuery.statisticType; // 匹配产线名称 - const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId); - item.bindObjectName = targetLine ? targetLine.name : ''; - + // const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId); + // item.bindObjectName = targetLine ? targetLine.name : '' return item; - }); + }) this.listQuery.total = response.data?.total || 0; }) .catch(err => {