add:统计分析质量检测分析;足盘模糊查询

This commit is contained in:
zhangzhiqiang
2023-10-11 19:40:55 +08:00
parent 1954538af6
commit 5252da91e8
16 changed files with 434 additions and 62 deletions

View File

@@ -0,0 +1,197 @@
<template>
<el-dialog
title="工序设备"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="80%"
>
<el-card class="box-card" shadow="never">
<el-form ref="form" :inline="true" :model="form" :rules="rules" disabled size="mini">
<el-form-item label="所属工序">
<el-input v-model="form.workprocedure_name" style="width: 120px;" />
</el-form-item>
<el-form-item label="统计方式">
<el-input v-model="form.analysis" style="width: 120px;" />
</el-form-item>
<el-form-item label="统计开始时间">
<el-input v-model="form.start_time" style="width: 120px;" />
</el-form-item>
<el-form-item label="统计结束时间">
<el-input v-model="form.start_time" style="width: 120px;" />
</el-form-item>
</el-form>
</el-card>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="模糊搜索">
<el-input
v-model="query.search"
clearable
size="mini"
placeholder="编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
:render-header="labelHead"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="index" fixed width="80" label="序号" />
<el-table-column prop="device_name" fixed width="120" label="设备名称" />
<el-table-column prop="device_code" width="120" label="设备编号" />
<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 v-for="(item, index) in crud.data[0].header" :key="index" :label="item" 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>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import qualityanilysis from '@/views/wms/analysis_manage/qlmanage/qualityanilysis'
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'WorkprodureDevDialog',
components: { rrOperation, pagination, Treeselect },
cruds() {
return CRUD({ title: '工序设备', url: '/api/qualityanalysis/bydevice', crudMethod: { ...qualityanilysis }, optShow: {}})
},
mixins: [presenter(), header()],
dicts: ['product_area'],
props: {
dialogShow: {
type: Boolean,
default: false
},
workprocedureid: {
type: String
},
analysis: {
type: String
},
createtime: {
type: String
}
},
data() {
return {
dialogVisible: false,
classes: [],
tableRadio: null,
class_idStr: null,
checkrow: null,
rows: [],
form: {
analysis: null,
workprocedure_name: null,
start_time: null,
end_time: null
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
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])
},
clickChange(item) {
this.tableRadio = item
},
openQ(query) {
this.crud.query = query
console.log(query)
this.form.analysis = query.analysis
this.form.workprocedure_name = query.workprocedure_name
if (query.create_time != undefined && query.create_time != null) {
this.form.start_time = query.create_time[0]
this.form.end_time = query.create_time[1]
}
this.dialogVisible = true
this.crud.toQuery()
},
handleSelectionChange(val, row) {
if (this.isSingle) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
this.dialogVisible = false
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -48,9 +48,9 @@
</el-form-item>
<el-form-item label="统计类型">
<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 label="1"></el-radio>
<el-radio label="2"></el-radio>
<el-radio label="3"></el-radio>
</el-radio-group>
</el-form-item>
<rrOperation />
@@ -58,16 +58,16 @@
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<!-- <el-button-->
<!-- slot="right"-->
<!-- class="filter-item"-->
<!-- type="warning"-->
<!-- icon="el-icon-check"-->
<!-- size="mini"-->
<!-- @click="sync"-->
<!-- >-->
<!-- 同步-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- slot="right"-->
<!-- class="filter-item"-->
<!-- type="warning"-->
<!-- icon="el-icon-check"-->
<!-- size="mini"-->
<!-- @click="sync"-->
<!-- >-->
<!-- 同步-->
<!-- </el-button>-->
</crudOperation>
<!--表格渲染-->
<el-table
@@ -79,49 +79,54 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="index" width="80" label="序号"/>
<el-table-column type="index" fixed width="80" label="序号" />
<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>
<el-table-column prop="workprocedure_code" label="工序编号" width="120" show-overflow-tooltip />
<el-table-column prop="workprocedure_code" fixed label="工序编号" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<el-link type="warning" @click="bydevice(scope.$index, scope.row)">{{ scope.row.workprocedure_code }}</el-link>
</template>
</el-table-column>
<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" >
<el-table-column v-for="(item, index) in crud.data[0].header" :key="index" :label="item" 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" >
<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" >
<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" >
<el-table-column label="废品率%" width="120">
<template slot-scope="scope">
<span>{{ scope.row.item[index].nok_rate}}</span>
<span>{{ scope.row.item[index].nok_rate }}</span>
</template>
</el-table-column>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
<WorkprodureDevDialog ref="WorkprodureDevDialog" :dialog-show.sync="workproduceShow" />
</div>
<div id="main2" style="width: 100%;height:350px;"></div>
<div id="main2" style="width: 100%;height:350px;" />
</div>
</template>
<script>
import WorkprodureDevDialog from '@/views/wms/analysis_manage/qlmanage/WorkprodureDevDialog'
import qualityanilysis from '@/views/wms/analysis_manage/qlmanage/qualityanilysis'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
@@ -133,12 +138,12 @@ import echarts from 'echarts'
const defaultForm = {
analysis: '1',
product_area : 'A1',
product_area: 'A1'
}
export default {
name: 'WorkGood',
dicts: ['product_area'],
components: { pagination, crudOperation, rrOperation },
components: { WorkprodureDevDialog, pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -164,10 +169,13 @@ export default {
}
}
return {
workproduceShow: false,
nowrow: {},
nowindex: '',
measure_unit: [],
sects: [],
workList: [],
headerData:[],
headerData: [],
product_area: 'A1',
downloadLoading: false,
permission: {
@@ -184,33 +192,34 @@ export default {
this.query.analysis = '1'
},
methods: {
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])
},
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(() => { })
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])
},
getWorkprocedure() { // 获取工序下拉框
crudDevice.getWorkprocedure().then(res => {
this.workList = res
})
},
bydevice(index, row) {
this.workproduceShow = true
this.crud.query.workprocedure_id = row.workprocedure_id
this.crud.query.workprocedure_name = row.workprocedure_name
this.$refs.WorkprodureDevDialog.openQ(this.crud.query)
},
[CRUD.HOOK.afterRefresh]() {
var legendData =[]
var xAxisData =this.crud.data[0].header
var seriesData =[]
this.crud.data.forEach(a=>{
legendData.push(a.workprocedure_name);
seriesData.push({"data":a.viewData,"name":a.workprocedure_name, "type": 'line',"stack": a.workprocedure_name})
}
var legendData = []
var xAxisData = this.crud.data[0].header
var seriesData = []
this.crud.data.forEach(a => {
legendData.push(a.workprocedure_name)
seriesData.push({ 'data': a.viewData, 'name': a.workprocedure_name, 'type': 'line', 'stack': a.workprocedure_name })
}
)
var myChart = echarts.init(document.getElementById('main2'));
var myChart = echarts.init(document.getElementById('main2'))
var option = {
title: {
text: '工序废品率'
@@ -238,11 +247,11 @@ export default {
data: xAxisData
},
yAxis: {
type: 'value',
type: 'value'
},
series: seriesData
};
myChart.setOption(option);
}
myChart.setOption(option)
},
downloadMethod() {
this.beforeInit()

View File

@@ -1,4 +1,5 @@
import request from '@/utils/request'
import qs from 'qs'
export function add(data) {
return request({
@@ -16,6 +17,12 @@ export function del(ids) {
})
}
export function bydevice(param) {
return request({
url: 'api/qualityanalysis/bydevice' + '?' + qs.stringify(param, { indices: false }),
method: 'get'
})
}
export function edit(data) {
return request({
@@ -24,4 +31,4 @@ export function edit(data) {
data
})
}
export default { add, edit, del }
export default { add, edit, del, bydevice }

View File

@@ -87,7 +87,7 @@
</template>
<script>
import dailyStructivt from '@/views/wms/masterdata_manage/st/dailyStructivt/dailyStructivt'
import qualityanilysis from '@/views/wms/analysis_manage/qlmanage/qualityanilysis'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'