projects/mescc/dy #46

Merged
juzi merged 2 commits from projects/mescc/dy into projects/mescc/develop 2024-06-18 08:49:31 +08:00
4 changed files with 79 additions and 56 deletions
Showing only changes of commit e990680159 - Show all commits

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-04-17 16:31:51
* @LastEditTime: 2024-06-07 14:44:22
* @LastEditTime: 2024-06-17 16:55:04
* @LastEditors: DY
* @Description:
-->
@ -11,7 +11,7 @@
{{ dataForm.id ? '编辑' : '新增' }}
</small-title>
<div class="detailBox">
<el-form ref="form" :model="dataForm" label-width="80px" label-position="top">
<el-form ref="form" :model="dataForm" label-width="80px" :rules="dataRule" label-position="top">
<el-row :gutter="24" style="padding: 0 32px;">
<el-col :span="8">
<el-form-item v-if="ftype === 0" label="工厂名称" prop="factory">
@ -29,7 +29,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="时间维度" prop="targetType">
<el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable>
<el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable @change="clearTime">
<!-- <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" />
@ -40,19 +40,19 @@
</el-col>
<el-col :span="8">
<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 v-model="dataForm.reportTime" value-format="yyyyMMdd" type="date" placeholder="选择日">
</el-date-picker>
</el-form-item>
<el-form-item v-show="dataForm.targetType === 1" label="时间" prop="week">
<el-date-picker v-model="week" type="week" format="yyyy 第 WW 周" placeholder="选择周">
<el-form-item v-show="dataForm.targetType === 1" label="时间" prop="reportTime">
<el-date-picker v-model="week" type="week" format="yyyy 第 WW 周" placeholder="选择周" @change="setReportTime">
</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 v-model="dataForm.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 clearable v-model="dataForm.reportTime" value-format="yyyy" type="year" placeholder="开始时间">
</el-date-picker>
</el-form-item>
</el-col>
@ -265,9 +265,10 @@ export default {
teamList: [],
sectionList: [],
visible: false,
reportTime: undefined,
// reportTime: undefined,
week: undefined,
dataForm: {
reportTime: undefined,
factoryType: 0,
id: undefined,
factory: undefined,
@ -303,9 +304,9 @@ export default {
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
// workOrderId: [{ required: true, message: "", trigger: "change" }],
// num: [{ required: true, message: "", trigger: "blur" }],
factory: [{ required: true, message: "工厂名称不能为空", trigger: "chnage" }],
reportTime: [{ required: true, message: "时间不能为空", trigger: "change" }],
targetType: [{ required: true, message: "时间维度不能为空", trigger: "change" }]
// detId: [{ required: true, message: "", trigger: "change" }],
// logTime: [{ required: true, message: "", trigger: "change" }],
@ -316,6 +317,13 @@ export default {
// this.getCurrentTime()
},
methods: {
setReportTime() {
this.dataForm.reportTime = this.week
},
clearTime() {
this.week = undefined
this.dataForm.reportTime = undefined
},
formClear() {
if (this.$refs.dataForm !== undefined) {
this.$refs.dataForm.resetFields()
@ -325,35 +333,41 @@ export default {
// this.dataForm.targetTime = undefined
// },
handleClose() {
//
if (this.dataForm.targetType === 1) {
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.id) {
//
updateProduceTarget({
...this.dataForm
}).then(res => {
if (res.code === 0) {
this.$message.success('修改成功!')
this.visible = false
this.$emit('refreshDataList')
this.$refs["form"].validate(valid => {
if (valid) {
//
if (this.dataForm.targetType === 1) {
this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : ''
} else {
this.dataForm.targetTime = this.dataForm.reportTime ? Number(this.dataForm.reportTime) : ''
}
})
} else {
//
createProduce({
...this.dataForm
}).then(res => {
if (res.code === 0) {
this.$message.success('新增成功!')
this.visible = false
this.$emit('refreshDataList')
if (this.dataForm.id) {
//
updateProduceTarget({
...this.dataForm,
reportTime: undefined
}).then(res => {
if (res.code === 0) {
this.$message.success('修改成功!')
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
//
createProduce({
...this.dataForm,
reportTime: undefined
}).then(res => {
if (res.code === 0) {
this.$message.success('新增成功!')
this.visible = false
this.$emit('refreshDataList')
}
})
}
})
}
}
})
},
init(id) {
this.dataForm.id = id || undefined
@ -363,7 +377,8 @@ export default {
getProduceTargetDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
if (this.dataForm.targetType === 0 || this.dataForm.targetType === 2 || this.dataForm.targetType === 3) {
this.reportTime = String(this.dataForm.targetTime)
// this.dataForm.reportTime = String(this.dataForm.targetTime)
this.$set(this.dataForm, 'reportTime', String(this.dataForm.targetTime))
}
if (this.dataForm.targetType === 1) {
const date = new Date()
@ -372,6 +387,7 @@ export default {
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
this.$set(this.dataForm, 'reportTime', date)
}
})
}

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-05 16:19:04
* @LastEditTime: 2024-06-17 09:49:15
* @LastEditors: DY
* @Description:
-->
@ -24,7 +24,7 @@
</el-select>
</el-form-item>
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择" @change="clearTime">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
@ -458,6 +458,13 @@ export default {
this.changeTime()
},
methods: {
clearTime() {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
this.listQuery.reportTime = []
this.start = undefined
this.end = undefined
},
handleImport() {
this.upload.title = "生产目标导入";
this.upload.open = true;

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-06-14 10:55:21
* @LastEditTime: 2024-06-17 17:03:17
* @LastEditors: DY
* @Description:
-->
@ -23,7 +23,7 @@
</el-col>
<el-col :span="3">
<p class="title">工单类型</p>
<p class="text">{{ ['', '芯片单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}</p>
<p class="text">{{ ['', '芯片单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}</p>
</el-col>
<el-col :span="3">
<p class="title">工单来源</p>
@ -39,7 +39,7 @@
</el-col>
<el-col :span="3">
<p class="title">工单状态</p>
<p class="text">{{ ['未开始', '生产中', '已完成'][dataForm.orderStatus] }}</p>
<p class="text">{{ ['', '未开始', '生产中', '已完成'][dataForm.orderStatus] }}</p>
</el-col>
<el-col :span="3">
<p class="title">投入状态</p>
@ -83,7 +83,7 @@
</div>
<div class="chartDiv">
<div ref="equipmentLine" :style="{ height: '30vh', width: '40vw' }" />
<div ref="line" v-show="dataForm.orderStatus === 1" :style="{ height: '30vh', width: '40vw' }" />
<div ref="line" v-show="dataForm.orderStatus === 2" :style="{ height: '30vh', width: '40vw' }" />
</div>
</div>
</el-drawer>
@ -267,7 +267,7 @@ export default {
this.pieChart = echarts.init(this.$refs['pie'])
this.pieChart.setOption({
title: {
text: '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%',
text: !isNaN((pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100) ? ( '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%') : '产品良率 -',
left: 'center'
// subtext: 'Fake Data'
},

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-14 11:04:04
* @LastEditTime: 2024-06-17 16:32:02
* @LastEditors: DY
* @Description:
-->
@ -88,7 +88,7 @@ export default {
factorys: ['瑞昌中建材', '邯郸中建材', '株洲中建材', '佳木斯中建材', '成都中建材', '凯盛光伏', '蚌埠兴科'],
factoryNum: [0, 0, 0, 0, 0, 0, 0],
inputNum: 0,
heightNum: 210,
heightNum: 180,
factoryList,
factoryArray,
listQuery: {
@ -141,15 +141,15 @@ export default {
selectOptions: [
{
label: '未开始',
value: 0
},
{
label: '生产中',
value: 1
},
{
label: '已完成',
label: '生产中',
value: 2
},
{
label: '已完成',
value: 3
}
],
labelField: "label",
@ -247,7 +247,7 @@ export default {
prop: 'orderStatus',
label: '工单状态',
// filter: publicFormatter('workorder_status')
filter: (val) => ['未开始', '生产中', '已完成'][val],
filter: (val) => ['', '未开始', '生产中', '已完成'][val],
},
{
prop: 'startTime',
@ -396,7 +396,7 @@ export default {
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 80px);
height: calc(100vh - 40px);
overflow: auto;
}
</style>