This commit is contained in:
helloDy 2024-06-18 08:47:53 +08:00
parent e1e39681ce
commit e990680159
4 changed files with 79 additions and 56 deletions

View File

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

View File

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

View File

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

View File

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