生产管理
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-17 16:31:51
|
||||
* @LastEditTime: 2024-05-20 18:09:09
|
||||
* @LastEditTime: 2024-05-29 14:06:16
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
-->
|
||||
@@ -29,20 +29,30 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="时间维度" prop="targetType">
|
||||
<el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable @change="clearTime">
|
||||
<el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable>
|
||||
<!-- <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"> -->
|
||||
<el-option label="月" :value="0" />
|
||||
<el-option label="年" :value="1" />
|
||||
<el-option label="日" :value="0" />
|
||||
<el-option label="周" :value="1" />
|
||||
<el-option label="月" :value="2" />
|
||||
<el-option label="年" :value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item v-show="dataForm.targetType !== 1" label="时间" prop="reportTime">
|
||||
<el-date-picker v-model="dataForm.reportTime" value-format="yyyy-MM" type="month" placeholder="选择月份">
|
||||
<el-form-item v-show="dataForm.targetType === 0 || dataForm.targetType === ''" label="时间" prop="reportTime">
|
||||
<el-date-picker v-model="reportTime" value-format="yyyyMMdd" type="date" placeholder="选择日">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="dataForm.targetType === 1" label="时间" prop="targetYear">
|
||||
<el-date-picker clearable v-model="dataForm.showYear" value-format="yyyy" type="year" placeholder="开始时间">
|
||||
<el-form-item v-show="dataForm.targetType === 1" label="时间" prop="week">
|
||||
<el-date-picker v-model="week" type="week" format="yyyy 第 WW 周" placeholder="选择周">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="dataForm.targetType === 2" label="时间" prop="reportTime">
|
||||
<el-date-picker v-model="reportTime" value-format="yyyyMM" type="month" placeholder="选择月份">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="dataForm.targetType === 3" label="时间" prop="reportTime">
|
||||
<el-date-picker clearable v-model="reportTime" value-format="yyyy" type="year" placeholder="开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -225,6 +235,7 @@
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { createProduce, getProduceTargetDetail, updateProduceTarget } from '@/api/produceData';
|
||||
import { factoryList, tyjxfactoryList, dhgfactoryList } from "@/utils/constants";
|
||||
import moment from 'moment'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -247,57 +258,16 @@ export default {
|
||||
workOrderList: [],
|
||||
detList: [],
|
||||
teamList: [],
|
||||
sourceList: [
|
||||
{
|
||||
id: 1,
|
||||
name: '手动',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '自动',
|
||||
}
|
||||
],
|
||||
// factoryList: [
|
||||
// {
|
||||
// name: '瑞昌中建材光电材料有限公司',
|
||||
// id: 0
|
||||
// },
|
||||
// {
|
||||
// name: '邯郸中建材光电材料有限公司',
|
||||
// id: 1
|
||||
// },
|
||||
// {
|
||||
// name: '中建材株洲光电材料有限公司',
|
||||
// id: 2
|
||||
// },
|
||||
// {
|
||||
// name: '佳木斯中建材光电材料有限公司',
|
||||
// id: 3
|
||||
// },
|
||||
// {
|
||||
// name: '成都中建材光电材料有限公司',
|
||||
// id: 4
|
||||
// },
|
||||
// {
|
||||
// name: '凯盛光伏材料有限公司',
|
||||
// id: 5
|
||||
// },
|
||||
// {
|
||||
// name: '蚌埠兴科玻璃有限公司',
|
||||
// id: 6
|
||||
// }
|
||||
// ],
|
||||
sectionList: [],
|
||||
visible: false,
|
||||
reportTime: undefined,
|
||||
week: undefined,
|
||||
dataForm: {
|
||||
factoryType: 0,
|
||||
id: undefined,
|
||||
reportTime: undefined, // 月时间
|
||||
factory: undefined,
|
||||
targetType: undefined,
|
||||
targetYear: undefined,
|
||||
showYear: undefined,
|
||||
targetMonth: undefined,
|
||||
targetTime: undefined,
|
||||
targetType: 0,
|
||||
chipYield: undefined,
|
||||
chipYieldRate: undefined,
|
||||
chipBom: undefined,
|
||||
@@ -345,31 +315,20 @@ export default {
|
||||
this.$refs.dataForm.resetFields()
|
||||
}
|
||||
},
|
||||
clearTime() {
|
||||
this.dataForm.targetYear = undefined
|
||||
this.dataForm.targetMonth = undefined
|
||||
},
|
||||
// clearTime() {
|
||||
// this.dataForm.targetTime = undefined
|
||||
// },
|
||||
handleClose() {
|
||||
// 新增
|
||||
if (this.dataForm.targetType === 0) {
|
||||
const timeArray = this.dataForm.reportTime.split('-')
|
||||
this.dataForm.targetYear = Number(timeArray[0])
|
||||
this.dataForm.targetMonth = Number(timeArray[1])
|
||||
}
|
||||
if (this.dataForm.targetType === 1) {
|
||||
this.dataForm.targetYear = Number(this.dataForm.showYear)
|
||||
this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : undefined
|
||||
} else {
|
||||
this.dataForm.targetTime = this.reportTime ? Number(this.reportTime) : undefined
|
||||
}
|
||||
// if (this.dataForm.factory === 5) {
|
||||
// this.dataForm.factoryType = 1
|
||||
// } else {
|
||||
// this.dataForm.factoryType = 0
|
||||
// }
|
||||
if (this.dataForm.id) {
|
||||
// 修改
|
||||
updateProduceTarget({
|
||||
...this.dataForm,
|
||||
showYear: undefined,
|
||||
reportTime: undefined
|
||||
...this.dataForm
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('修改成功!')
|
||||
@@ -380,9 +339,7 @@ export default {
|
||||
} else {
|
||||
// 新增
|
||||
createProduce({
|
||||
...this.dataForm,
|
||||
showYear: undefined,
|
||||
reportTime: undefined
|
||||
...this.dataForm
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('新增成功!')
|
||||
@@ -399,19 +356,16 @@ export default {
|
||||
if (this.dataForm.id) {
|
||||
getProduceTargetDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
if (this.dataForm.targetType === 1) {
|
||||
if (this.dataForm.targetYear) {
|
||||
this.$set(this.dataForm, 'showYear', String(this.dataForm.targetYear))
|
||||
}
|
||||
if (this.dataForm.targetType === 0 || this.dataForm.targetType === 2 || this.dataForm.targetType === 3) {
|
||||
this.reportTime = String(this.dataForm.targetTime)
|
||||
}
|
||||
if (this.dataForm.targetType === 0) {
|
||||
if (this.dataForm.targetYear && this.dataForm.targetMonth !== null) {
|
||||
if (this.dataForm.targetMonth < 10) {
|
||||
this.$set(this.dataForm, 'reportTime', String(this.dataForm.targetYear) + '-0' + String(this.dataForm.targetMonth))
|
||||
} else {
|
||||
this.$set(this.dataForm, 'reportTime', String(this.dataForm.targetYear) + '-' + String(this.dataForm.targetMonth))
|
||||
}
|
||||
}
|
||||
if (this.dataForm.targetType === 1) {
|
||||
const date = new Date()
|
||||
date.setFullYear(String(this.dataForm.targetTime).slice(0, 4))
|
||||
date.setMonth(0)
|
||||
date.setDate((Number(String(this.dataForm.targetTime).slice(4)) - 1)* 7 + 1)
|
||||
// console.log('你好', date, moment(date).format('yyyyWW'), String(this.dataForm.targetTime).slice(4))
|
||||
this.week = date
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -424,6 +378,7 @@ export default {
|
||||
position: absolute;
|
||||
bottom: 1%;
|
||||
right: 2%;
|
||||
z-index: 999;
|
||||
}
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-15 10:49:13
|
||||
* @LastEditTime: 2024-05-22 16:22:57
|
||||
* @LastEditTime: 2024-05-31 16:41:12
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
|
||||
<ButtonNav :menus="['碲化镉工厂', '铜铟镓硒工厂']" :button-mode="true" @change="changeFactory" style="margin-top: -10px">
|
||||
<ButtonNav v-show="false" :menus="['碲化镉工厂', '铜铟镓硒工厂']" :button-mode="true" @change="changeFactory" style="margin-top: -10px">
|
||||
</ButtonNav>
|
||||
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
|
||||
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
|
||||
@@ -29,34 +29,34 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item v-show="timeSelect === 'day'" label="时间范围" prop="reportTime">
|
||||
<el-date-picker v-model="listQuery.reportTime" type="datetimerange" range-separator="至"
|
||||
start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
|
||||
<el-form-item v-show="listQuery.date === 1 || listQuery.date === ''" label="时间范围" prop="reportTime">
|
||||
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="datetimerange" range-separator="至"
|
||||
start-placeholder="开始日期" value-format="yyyyMMdd" @change="changeDayTime" end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item v-show="timeSelect === 'week'" label="时间范围" prop="reportTime">
|
||||
<el-date-picker v-model="listQuery.reportTime[0]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
|
||||
</el-form-item>
|
||||
<el-form-item v-show="listQuery.date === 2" label="时间范围" prop="reportTime">
|
||||
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
|
||||
style="width: 180px" @change="onValueChange">
|
||||
</el-date-picker>
|
||||
至
|
||||
<el-date-picker v-model="listQuery.reportTime[1]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
|
||||
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
|
||||
style="width: 180px" @change="onValueChange">
|
||||
</el-date-picker>
|
||||
<span v-if="listQuery.reportTime[0] && listQuery.reportTime[1]" style="margin-left: 10px">
|
||||
<span v-if="start && end" style="margin-left: 10px">
|
||||
{{ date1 }} 至 {{ date2 }},共 {{ weekNum }} 周
|
||||
</span>
|
||||
</el-form-item> -->
|
||||
<el-form-item v-show="listQuery.date !== 4" label="时间值" prop="reportTime">
|
||||
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="timestamp" range-separator="至" start-placeholder="开始月份"
|
||||
</el-form-item>
|
||||
<el-form-item v-show="listQuery.date === 3" label="时间值" prop="reportTime">
|
||||
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyyMM" range-separator="至" start-placeholder="开始月份"
|
||||
end-placeholder="结束月份" @change="changeTime">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="listQuery.date === 4" label="时间值" prop="reportTime">
|
||||
<el-date-picker size="small" clearable v-model="start" value-format="timestamp" type="year"
|
||||
<el-date-picker size="small" clearable v-model="start" value-format="yyyy" type="year"
|
||||
placeholder="开始时间">
|
||||
</el-date-picker>
|
||||
~
|
||||
<el-date-picker size="small" clearable v-model="end" value-format="timestamp" type="year" placeholder="结束时间"
|
||||
<el-date-picker size="small" clearable v-model="end" value-format="yyyy" type="year" placeholder="结束时间"
|
||||
@change="getYear">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
@@ -173,7 +173,7 @@ export default {
|
||||
current: 1,
|
||||
factorys: null,
|
||||
total: 0,
|
||||
date: undefined,
|
||||
date: 1,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
reportTime: []
|
||||
@@ -314,9 +314,17 @@ export default {
|
||||
},
|
||||
],
|
||||
timeList: [
|
||||
{
|
||||
value: 1,
|
||||
label: '日'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '周'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label:'月'
|
||||
label: '月'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
@@ -332,13 +340,13 @@ export default {
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'tagertTime',
|
||||
prop: 'targetTime',
|
||||
label: '目标时间',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
prop: 'updateTime',
|
||||
label: '提交时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150,
|
||||
@@ -418,11 +426,11 @@ export default {
|
||||
// all: {}
|
||||
};
|
||||
},
|
||||
// computed: {
|
||||
// weekNum() {
|
||||
// return Math.round((this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 60 * 60 * 1000 * 7)) + 1
|
||||
// },
|
||||
// },
|
||||
computed: {
|
||||
weekNum() {
|
||||
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
facType(value) {
|
||||
if (value === 0) {
|
||||
@@ -569,36 +577,75 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.detailOrUpdate.init(val.data.id);
|
||||
});
|
||||
},
|
||||
buttonClick() {
|
||||
|
||||
},
|
||||
getYear(e) {
|
||||
if (this.end && e - this.start > 10 * 365*24*60*60*1000) {
|
||||
if (this.end && Number(this.end) - Number(this.start) > 10) {
|
||||
this.$message({
|
||||
message: '年份起止时间不能超过十年',
|
||||
type: 'warning'
|
||||
});
|
||||
this.start = undefined
|
||||
this.end = undefined
|
||||
// console.log();
|
||||
} else {
|
||||
if (this.end < this.start) {
|
||||
if (Number(this.end) < Number(this.start)) {
|
||||
this.$message({
|
||||
message: '结束年份不能小于开始年份',
|
||||
type: 'warning'
|
||||
});
|
||||
this.start = undefined
|
||||
this.end = undefined
|
||||
} else {
|
||||
this.listQuery.beginTime = Number(this.start)
|
||||
this.listQuery.endTime = Number(this.end)
|
||||
}
|
||||
}
|
||||
// console.log(e);
|
||||
},
|
||||
changeTime() {
|
||||
if (this.listQuery.reportTime) {
|
||||
const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0]
|
||||
if (numDays > 2*365*24*60*60*1000) {
|
||||
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
|
||||
if (numDays > 24) {
|
||||
this.$message({
|
||||
message: '时间范围不能超过24个月',
|
||||
type: 'warning'
|
||||
});
|
||||
this.listQuery.reportTime = [];
|
||||
} else {
|
||||
this.listQuery.beginTime = Number(this.listQuery.reportTime[0])
|
||||
this.listQuery.endTime = Number(this.listQuery.reportTime[1])
|
||||
}
|
||||
}
|
||||
},
|
||||
onValueChange(picker, k) { // 选中近k周后触发的操作
|
||||
if (this.start && this.end) {
|
||||
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||
this.date2 = moment(this.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)
|
||||
this.$message({
|
||||
message: '周范围不能超过24周',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
this.listQuery.beginTime = Number(moment(this.start.getTime()).format('YYYYWW'))
|
||||
this.listQuery.endTime = Number(moment(this.end.getTime()).format('YYYYWW'))
|
||||
}
|
||||
}
|
||||
},
|
||||
changeDayTime() {
|
||||
if (this.listQuery.reportTime) {
|
||||
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
|
||||
if (numDays > 30) {
|
||||
this.$message({
|
||||
message: '时间范围不能超过30天',
|
||||
type: 'warning'
|
||||
});
|
||||
this.listQuery.reportTime = [];
|
||||
} else {
|
||||
this.listQuery.beginTime = Number(this.listQuery.reportTime[0])
|
||||
this.listQuery.endTime = Number(this.listQuery.reportTime[1])
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -626,27 +673,22 @@ export default {
|
||||
|
||||
},
|
||||
async getDataList() {
|
||||
if (this.listQuery.date === 3) {
|
||||
if (this.listQuery.reportTime?.length > 0) {
|
||||
this.listQuery.beginTime = this.listQuery.reportTime[0] ? this.listQuery.reportTime[0] : undefined
|
||||
this.listQuery.endTime = this.listQuery.reportTime[1] ? this.listQuery.reportTime[1] : undefined
|
||||
}
|
||||
}
|
||||
if (this.listQuery.date === 4) {
|
||||
if (this.listQuery.reportTime?.length > 0) {
|
||||
this.listQuery.beginTime = this.start ? this.start : undefined
|
||||
this.listQuery.endTime = this.end ? this.end : undefined
|
||||
}
|
||||
}
|
||||
// if (this.listQuery.date === 3) {
|
||||
// if (this.listQuery.reportTime?.length > 0) {
|
||||
// this.listQuery.beginTime = this.listQuery.reportTime[0] ? Number(this.listQuery.reportTime[0]) : undefined
|
||||
// this.listQuery.endTime = this.listQuery.reportTime[1] ? this.listQuery.reportTime[1] : undefined
|
||||
// }
|
||||
// }
|
||||
// if (this.listQuery.date === 4) {
|
||||
// if (this.listQuery.reportTime?.length > 0) {
|
||||
// this.listQuery.beginTime = this.start ? this.start : undefined
|
||||
// this.listQuery.endTime = this.end ? this.end : undefined
|
||||
// }
|
||||
// }
|
||||
if (this.currentMenu === '碲化镉工厂') {
|
||||
await prodTargetDiPage(this.listQuery).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.records
|
||||
this.tableData.forEach(item => {
|
||||
const year = item.targetYear ? item.targetYear + '年' : ''
|
||||
const month = item.targetMonth ? item.targetMonth + '月' : ''
|
||||
item.tagertTime = year + month
|
||||
})
|
||||
this.listQuery.total = res.data.total
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user