2023-10-08 10:22:18 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<div class="head-container">
|
|
|
|
|
|
<div v-if="crud.props.searchToggle">
|
|
|
|
|
|
<el-form
|
|
|
|
|
|
:inline="true"
|
|
|
|
|
|
class="demo-form-inline"
|
|
|
|
|
|
label-position="right"
|
|
|
|
|
|
label-width="80px"
|
|
|
|
|
|
label-suffix=":"
|
|
|
|
|
|
>
|
2023-10-09 09:37:14 +08:00
|
|
|
|
<el-form-item label="车间">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="query.product_area"
|
2023-10-08 10:22:18 +08:00
|
|
|
|
clearable
|
2023-10-09 09:37:14 +08:00
|
|
|
|
size="mini"
|
|
|
|
|
|
placeholder="全部"
|
2023-10-08 10:22:18 +08:00
|
|
|
|
class="filter-item"
|
2023-10-09 09:37:14 +08:00
|
|
|
|
@change="crud.toQuery"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in dict.product_area"
|
|
|
|
|
|
:key="item.value"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:value="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="生产日期">
|
|
|
|
|
|
<el-date-picker
|
|
|
|
|
|
v-model="query.create_time"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
|
:default-time="['00:00:00','23:59:59']"
|
2023-10-08 10:22:18 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
2023-10-09 09:37:14 +08:00
|
|
|
|
<el-form-item label="所属工序">
|
|
|
|
|
|
<el-select v-model="query.workprocedure_id" class="filter-item" clearable filterable placeholder="所属工序" size="small" style="width: 280px">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in workList"
|
|
|
|
|
|
:key="item.workprocedure_id"
|
|
|
|
|
|
:label="item.workprocedure_name"
|
|
|
|
|
|
:value="item.workprocedure_id"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2023-10-09 13:40:11 +08:00
|
|
|
|
<el-form-item label="统计类型">
|
2023-10-10 16:41:52 +08:00
|
|
|
|
<el-radio-group v-model="query.analysis" size="small" @change="crud.toQuery">
|
|
|
|
|
|
<el-radio label="1">日</el-radio>
|
|
|
|
|
|
<el-radio label="2">周</el-radio>
|
|
|
|
|
|
<el-radio label="3">月</el-radio>
|
|
|
|
|
|
</el-radio-group>
|
2023-10-09 13:40:11 +08:00
|
|
|
|
</el-form-item>
|
2023-10-08 10:22:18 +08:00
|
|
|
|
<rrOperation />
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
|
|
|
|
<crudOperation :permission="permission">
|
2023-10-09 09:37:14 +08:00
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
|
<!-- slot="right"-->
|
|
|
|
|
|
<!-- class="filter-item"-->
|
|
|
|
|
|
<!-- type="warning"-->
|
|
|
|
|
|
<!-- icon="el-icon-check"-->
|
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
|
<!-- @click="sync"-->
|
|
|
|
|
|
<!-- >-->
|
|
|
|
|
|
<!-- 同步-->
|
|
|
|
|
|
<!-- </el-button>-->
|
2023-10-08 10:22:18 +08:00
|
|
|
|
</crudOperation>
|
|
|
|
|
|
<!--表格渲染-->
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
ref="table"
|
|
|
|
|
|
v-loading="crud.loading"
|
|
|
|
|
|
:data="crud.data"
|
2023-10-10 16:41:52 +08:00
|
|
|
|
:render-header="labelHead"
|
2023-10-08 10:22:18 +08:00
|
|
|
|
size="mini"
|
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
@selection-change="crud.selectionChangeHandler"
|
|
|
|
|
|
>
|
2023-10-10 16:41:52 +08:00
|
|
|
|
<el-table-column type="index" width="80" label="序号"/>
|
2023-10-09 09:37:14 +08:00
|
|
|
|
<el-table-column prop="product_area" width="120" label="所属车间">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
{{ dict.label.product_area[scope.row.product_area] }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2023-10-10 16:41:52 +08:00
|
|
|
|
<el-table-column prop="workprocedure_code" label="工序编号" width="120" show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column prop="workprocedure_name" label="工序名称" width="150" />
|
|
|
|
|
|
<el-table-column prop="total_order_count" label="总工单数" width="100" />
|
|
|
|
|
|
<el-table-column prop="total_real_qty" label="总生产数" width="150" />
|
|
|
|
|
|
<el-table-column prop="total_nok_qty" label="总废品数" width="150" />
|
|
|
|
|
|
<el-table-column :label="item" v-for="(item, index) in crud.data[0].header" :key="index" align="center">
|
|
|
|
|
|
<el-table-column label="工单数" width="60" >
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<span>{{ scope.row.item[index].order_count }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="生产数" width="120" >
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<span>{{ scope.row.item[index].real_qty }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="废品数" width="120" >
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<span>{{ scope.row.item[index].nok_qty }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="废品率%" width="120" >
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<span>{{ scope.row.item[index].nok_rate}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2023-10-09 09:37:14 +08:00
|
|
|
|
</el-table-column>
|
2023-10-08 10:22:18 +08:00
|
|
|
|
</el-table>
|
|
|
|
|
|
<!--分页组件-->
|
|
|
|
|
|
<pagination />
|
|
|
|
|
|
</div>
|
2023-10-09 09:37:14 +08:00
|
|
|
|
<div id="main2" style="width: 100%;height:350px;"></div>
|
|
|
|
|
|
|
2023-10-08 10:22:18 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-10-10 16:41:52 +08:00
|
|
|
|
import qualityanilysis from '@/views/wms/analysis_manage/qlmanage/qualityanilysis'
|
2023-10-08 10:22:18 +08:00
|
|
|
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
|
|
|
|
|
import crudOperation from '@crud/CRUD.operation'
|
|
|
|
|
|
import pagination from '@crud/Pagination'
|
|
|
|
|
|
import rrOperation from '@crud/RR.operation'
|
|
|
|
|
|
import { downloadFile } from '@/utils'
|
2023-10-09 09:37:14 +08:00
|
|
|
|
import crudDevice from '@/api/wms/pdm/device'
|
|
|
|
|
|
import echarts from 'echarts'
|
2023-10-08 10:22:18 +08:00
|
|
|
|
|
|
|
|
|
|
const defaultForm = {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
analysis: '1',
|
|
|
|
|
|
product_area : 'A1',
|
2023-10-08 10:22:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
export default {
|
2023-10-09 09:37:14 +08:00
|
|
|
|
name: 'WorkGood',
|
|
|
|
|
|
dicts: ['product_area'],
|
2023-10-08 10:22:18 +08:00
|
|
|
|
components: { pagination, crudOperation, rrOperation },
|
|
|
|
|
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
|
|
|
|
|
cruds() {
|
|
|
|
|
|
return CRUD({
|
2023-10-09 09:37:14 +08:00
|
|
|
|
title: '废品统计',
|
2023-10-08 10:22:18 +08:00
|
|
|
|
optShow: { add: false, reset: true },
|
2023-10-10 16:41:52 +08:00
|
|
|
|
url: 'api/qualityanalysis',
|
2023-10-08 10:22:18 +08:00
|
|
|
|
idField: 'id',
|
2023-10-10 16:41:52 +08:00
|
|
|
|
crudMethod: { ...qualityanilysis }
|
2023-10-08 10:22:18 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
const numberOne = (rule, value, callback) => {
|
|
|
|
|
|
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
|
|
|
|
|
const numRe = new RegExp(numReg)
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
if (!numRe.test(value)) {
|
|
|
|
|
|
callback(new Error('只能输入数字'))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback()
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
measure_unit: [],
|
|
|
|
|
|
sects: [],
|
2023-10-09 09:37:14 +08:00
|
|
|
|
workList: [],
|
2023-10-10 16:41:52 +08:00
|
|
|
|
headerData:[],
|
|
|
|
|
|
product_area: 'A1',
|
2023-10-08 10:22:18 +08:00
|
|
|
|
downloadLoading: false,
|
|
|
|
|
|
permission: {
|
|
|
|
|
|
add: ['admin', 'dept:add'],
|
|
|
|
|
|
edit: ['admin', 'dept:edit'],
|
|
|
|
|
|
del: ['admin', 'dept:del']
|
|
|
|
|
|
},
|
|
|
|
|
|
trueorfalse: [{ value: true, label: '是' }, { value: false, label: '否' }]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2023-10-09 09:37:14 +08:00
|
|
|
|
this.getWorkprocedure()
|
2023-10-10 16:41:52 +08:00
|
|
|
|
this.query.product_area = 'A1'
|
|
|
|
|
|
this.query.analysis = '1'
|
2023-10-08 10:22:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
labelHead(h,{column,index}){ //动态表头渲染
|
|
|
|
|
|
//let l = column.label.length;
|
|
|
|
|
|
//let f = 12; //每个字大小,其实是每个字的比例值,大概会比字体大小打差不多大
|
|
|
|
|
|
//column.minWidth = f * l; //字大小乘个数即长度 ,注意不要加px像素,这里minWidth只是一个比例值,不是真正的长度
|
|
|
|
|
|
//然后将列标题放在一个div块中,注意块的宽度一定要100%,否则表格显示不完全
|
|
|
|
|
|
return h('span',{class:'table-head',style:{width:'100%'}},[column.label])
|
|
|
|
|
|
},
|
2023-10-08 10:22:18 +08:00
|
|
|
|
sync() {
|
|
|
|
|
|
dailyStructivt.sync(Array.of('st_ivt_structivt_bcp', 'st_ivt_structivt_cp', 'st_ivt_structivt_yl')).then(result => {
|
|
|
|
|
|
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
|
|
|
|
}).catch(() => { })
|
|
|
|
|
|
},
|
2023-10-09 09:37:14 +08:00
|
|
|
|
getWorkprocedure() { // 获取工序下拉框
|
|
|
|
|
|
crudDevice.getWorkprocedure().then(res => {
|
|
|
|
|
|
this.workList = res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
[CRUD.HOOK.afterRefresh]() {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
var legendData =[]
|
|
|
|
|
|
var xAxisData =this.crud.data[0].header
|
|
|
|
|
|
var seriesData =[]
|
2023-10-09 09:37:14 +08:00
|
|
|
|
this.crud.data.forEach(a=>{
|
2023-10-10 16:41:52 +08:00
|
|
|
|
legendData.push(a.workprocedure_name);
|
|
|
|
|
|
seriesData.push({"data":a.viewData,"name":a.workprocedure_name, "type": 'line',"stack": a.workprocedure_name})
|
2023-10-09 09:37:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
var myChart = echarts.init(document.getElementById('main2'));
|
|
|
|
|
|
var option = {
|
|
|
|
|
|
title: {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
text: '工序废品率'
|
2023-10-09 09:37:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
tooltip: {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
trigger: 'axis'
|
2023-10-09 09:37:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
legend: {
|
2023-10-10 16:41:52 +08:00
|
|
|
|
data: legendData
|
|
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
left: '3%',
|
|
|
|
|
|
right: '4%',
|
|
|
|
|
|
bottom: '3%',
|
|
|
|
|
|
containLabel: true
|
2023-10-09 09:37:14 +08:00
|
|
|
|
},
|
2023-10-10 16:41:52 +08:00
|
|
|
|
toolbox: {
|
|
|
|
|
|
feature: {
|
|
|
|
|
|
saveAsImage: {}
|
2023-10-09 09:37:14 +08:00
|
|
|
|
}
|
2023-10-10 16:41:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
boundaryGap: false,
|
|
|
|
|
|
data: xAxisData
|
|
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
},
|
|
|
|
|
|
series: seriesData
|
2023-10-09 09:37:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
myChart.setOption(option);
|
|
|
|
|
|
},
|
2023-10-08 10:22:18 +08:00
|
|
|
|
downloadMethod() {
|
|
|
|
|
|
this.beforeInit()
|
|
|
|
|
|
this.downloadLoading = true
|
|
|
|
|
|
download(this.url + '/download', this.params).then(result => {
|
|
|
|
|
|
this.downloadFile(result, this.title + '数据', 'xlsx')
|
|
|
|
|
|
this.downloadLoading = false
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.downloadLoading = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeInit() {
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
|
|
|
|
|
sectChange(val) {
|
|
|
|
|
|
this.form.sect_id = val[1]
|
|
|
|
|
|
},
|
|
|
|
|
|
formatUnit(row, column) {
|
|
|
|
|
|
const values = this.measure_unit.filter(v => {
|
|
|
|
|
|
return v.value === row.qty_unit_id
|
|
|
|
|
|
})
|
|
|
|
|
|
return values[0].label
|
|
|
|
|
|
},
|
|
|
|
|
|
sectQueryChange(val) {
|
|
|
|
|
|
if (val.length === 1) {
|
|
|
|
|
|
this.query.stor_id = val[0]
|
|
|
|
|
|
this.query.sect_id = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (val.length === 0) {
|
|
|
|
|
|
this.query.sect_id = ''
|
|
|
|
|
|
this.query.stor_id = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (val.length === 2) {
|
|
|
|
|
|
this.query.stor_id = val[0]
|
|
|
|
|
|
this.query.sect_id = val[1]
|
|
|
|
|
|
}
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|