From fe39f72045803ff472fa7716bec7f6b9e34cff85 Mon Sep 17 00:00:00 2001 From: helloDy <1615073571@qq.com> Date: Wed, 22 May 2024 16:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 6 +- src/api/produceData/index.js | 20 ++- src/views/produce/data/add-or-updata.vue | 4 +- src/views/produce/data/index.vue | 98 +++++++------ src/views/produce/data/lineChart.vue | 56 ++------ src/views/produce/target/add-or-updata.vue | 17 ++- src/views/produce/target/detail-or-updata.vue | 102 ++++++++------ src/views/produce/target/index.vue | 131 +++++++++++++----- yarn.lock | 45 +++--- 9 files changed, 275 insertions(+), 204 deletions(-) diff --git a/.env.dev b/.env.dev index 6b6b439..8214fb5 100644 --- a/.env.dev +++ b/.env.dev @@ -1,7 +1,7 @@ ### # @Author: zhp # @Date: 2024-04-28 13:42:51 - # @LastEditTime: 2024-05-20 14:56:40 + # @LastEditTime: 2024-05-21 09:39:07 # @LastEditors: DY # @Description: ### @@ -12,8 +12,8 @@ ENV = 'development' VUE_APP_TITLE = 芋道管理系统 # 芋道管理系统/开发环境 -VUE_APP_BASE_API = 'http://192.168.1.61:48080' -# VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com' +# VUE_APP_BASE_API = 'http://192.168.1.61:48080' +VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com' # # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/src/api/produceData/index.js b/src/api/produceData/index.js index 84bbb40..5e99ead 100644 --- a/src/api/produceData/index.js +++ b/src/api/produceData/index.js @@ -1,7 +1,7 @@ /* * @Author: zhp * @Date: 2024-05-07 08:54:59 - * @LastEditTime: 2024-05-20 14:56:56 + * @LastEditTime: 2024-05-20 16:24:15 * @LastEditors: DY * @Description: */ @@ -105,6 +105,24 @@ export function delTarget(id) { }) } +// 导入铜铟镓硒工厂 +export function importToTarget(data) { + return request({ + url: '/ip/prod-target/to-target-import-excel', + method: 'post', + data + }) +} + +// 导入碲化镉工厂 +export function importDiTarget(data) { + return request({ + url: '/ip/prod-target/di-target-import-excel', + method: 'post', + data + }) +} + // export function cockpitDataMonitor(data) { // return request({ // url: '/ip/prod-output/cockpitDataMonitor', diff --git a/src/views/produce/data/add-or-updata.vue b/src/views/produce/data/add-or-updata.vue index e2a640e..07bad79 100644 --- a/src/views/produce/data/add-or-updata.vue +++ b/src/views/produce/data/add-or-updata.vue @@ -1,7 +1,7 @@ @@ -111,7 +111,7 @@ -

标准组件人均产量

+

标准组件平均功率

diff --git a/src/views/produce/data/index.vue b/src/views/produce/data/index.vue index 4210a64..92fa0e4 100644 --- a/src/views/produce/data/index.vue +++ b/src/views/produce/data/index.vue @@ -1,7 +1,7 @@ @@ -15,7 +15,7 @@ - + @@ -38,11 +38,11 @@ - ~ - @@ -132,7 +132,9 @@ export default { // reportType: 2, beginTime: undefined, endTime:undefined, - reportTime: [] + reportTime: [], + start: undefined, + end: undefined }, detailOrUpdateVisible:false, date1: undefined, @@ -283,19 +285,18 @@ export default { }, ], tableData: [], + xAxis: [] // proLineList: [], // all: {} }; }, computed: { weekNum() { - return Math.round((this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 60 * 60 * 1000 * 7)) + 1 + return Math.round((this.listQuery.end - this.listQuery.start) / (24 * 60 * 60 * 1000 * 7)) + 1 }, }, mounted() { - this.getDict() - // this.getCurrentYearFirst() - // this.getDataList() + this.getDataList() }, methods: { otherMethods(val) { @@ -309,25 +310,27 @@ export default { // }, getYear(e) { - if (this.listQuery.reportTime[1] - this.listQuery.reportTime[0] > 10*365*24*60*60*1000) { + if (this.listQuery.end - this.listQuery.start > 10*365*24*60*60*1000) { this.$message({ message: '年份起止时间不能超过十年', type: 'warning' }); this.listQuery.reportTime = [] + this.listQuery.start = undefined + this.listQuery.end = undefined // console.log(); } else { - this.listQuery.beginTime = this.listQuery.reportTime[0] - this.listQuery.endTime = this.listQuery.reportTime[1] + this.listQuery.beginTime = this.listQuery.start + this.listQuery.endTime = this.listQuery.end } // console.log(e); }, onValueChange(picker, k) { // 选中近k周后触发的操作 // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1]) - if (this.listQuery.reportTime[0] && this.listQuery.reportTime[1]) { + if (this.listQuery.start && this.listQuery.end) { console.log(this.listQuery.reportTime) - this.date1 = moment(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') - this.date2 = moment(this.listQuery.reportTime[1].getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); if (numDays > 168) { console.log(numDays) @@ -336,8 +339,8 @@ export default { type: 'warning' }); } else { - this.listQuery.beginTime = this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000 - this.listQuery.endTime = this.listQuery.reportTime[1].getTime() + 5 * 24 * 60 * 60 * 1000 + this.listQuery.beginTime = this.listQuery.start.getTime() - 24 * 60 * 60 * 1000 + this.listQuery.endTime = this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000 } } }, @@ -377,12 +380,11 @@ export default { console.log(this.listQuery.reportTime[0]) } }, - async getDict() { - this.$refs.lineChart.initChart() + // async getDict() { // 产线列表 // const res = await getCorePLList(); // this.proLineList = res.data; - }, + // }, // 获取数据列表 multipliedByHundred(str) { console.log(str); @@ -411,33 +413,43 @@ export default { console.log(res) this.tableData = res.data.records this.tableData.forEach(item => { - item.tableTime = item?.reportDate?.length > 0 ? item.reportDate[0] + '年' + item.reportDate[1] + '月' + item.reportDate[2] + '日' : '--' + item.tableTime = item?.reportDate?.length > 0 ? item.reportDate[0] + '-' + item.reportDate[1] + '-' + item.reportDate[2] : '--' }) this.listQuery.total = res.data.total + this.buildChart(this.tableData) }, - add0(m) { - return m < 10 ? '0' + m : m + buildChart(list) { + const chartList = Object.groupBy(list, (item) => item.tableTime) + this.xAxis = [] + this.seriesList = [] + for (const keyIndex in chartList) { + // X坐标轴数据 + this.xAxis.push(keyIndex) + } + // y轴数据 + for (const y of this.factoryList) { + // y: {name: , id: } + const seriesItem = { + name: y.name, + type: 'bar', + emphasis: { + focus: 'series' + }, + data: Array(this.xAxis.length).fill(0) + } + for (const a in chartList) { + for (const z of chartList[a]) { + this.xAxis.forEach((item, index) => { + if (z.factory === y.id && a === item) { + seriesItem.data[index] = z.goodNumber + } + }) + } + } + this.seriesList.push(seriesItem) + } + this.$refs.lineChart.initChart(this.xAxis, this.seriesList) }, - format(shijianchuo) { - //shijianchuo是整数,否则要parseInt转换 - var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss') - // console.log(time) - // var y = time.getFullYear(); - // var m = time.getMonth() + 1; - // var d = time.getDate(); - // var h = time.getHours(); - // var mm = time.getMinutes(); - // var s = time.getSeconds(); - return time - }, - //时间戳转为yy-mm-dd hh:mm:ss - timeFun(unixtimestamp) { - var unixtimestamp = new Date(unixtimestamp); - var year = 1900 + unixtimestamp.getYear(); - var month = "0" + (unixtimestamp.getMonth() + 1); - var date = "0" + unixtimestamp.getDate(); - return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length) - }, buttonClick(val) { this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined; switch (val.btnName) { diff --git a/src/views/produce/data/lineChart.vue b/src/views/produce/data/lineChart.vue index d00a133..d5761c1 100644 --- a/src/views/produce/data/lineChart.vue +++ b/src/views/produce/data/lineChart.vue @@ -1,8 +1,8 @@