add:working material

This commit is contained in:
zhangzhiqiang
2023-11-02 09:03:42 +08:00
parent d2cb0ed33e
commit 02367d3c06
2 changed files with 275 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
<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=":"
>
<el-form-item label="车间">
<el-select
v-model="query.product_area"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@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']"
/>
</el-form-item>
<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>
<rrOperation />
</el-form>
</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>-->
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column prop="product_area" width="150" label="所属车间">
<template slot-scope="scope">
{{ dict.label.product_area[scope.row.product_area] }}
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料名称" width="200" />
<el-table-column prop="material_spec" label="物料规格" width="200" />
<el-table-column prop="workprocedure_name" label="工序名称" width="200" show-overflow-tooltip />
<el-table-column prop="real_qty" label="生产数量" width="200" />
<el-table-column prop="plan_qty" label="计划数量" width="200" />
<el-table-column prop="dq_real_qty" label="电气统计数量" width="200" />
<el-table-column prop="create_time" label="统计日期" width="200" />
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import workinggood from '@/views/wms/analysis_manage/workingGoods/workinggood'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import crudSectattr from '@/api/wms/basedata/st/sectattr'
import rrOperation from '@crud/RR.operation'
import crudMdPbMeasureunit from '@/api/wms/basedata/master/mdPbMeasureunit'
import { downloadFile } from '@/utils'
import crudDevice from '@/api/wms/pdm/device'
const defaultForm = {
struct_id: null,
cascader: null,
struct_code: null,
struct_name: null,
simple_name: null,
sect_id: null,
sect_code: null,
sect_name: null,
stor_id: null,
material_code: null,
stor_code: null,
stor_name: null,
stor_type: null,
capacity: null,
width: null,
height: null,
zdepth: null,
weight: null,
xqty: null,
yqty: null,
zqty: null,
is_tempstruct: '0',
create_id: null,
create_name: null,
create_time: null,
update_optid: null,
update_optname: null,
update_time: null,
is_delete: null,
back_ground_color: null,
front_ground_color: null,
back_ground_pic: null,
font_direction_scode: null,
is_used: true,
is_zdepth: null,
storagevehicle_id: null,
storagevehicle_code: null,
storagevehicle_type: null,
is_emptyvehicle: null,
storagevehicle_qty: null,
lock_type: null,
material_height_type: null,
ext_id: null,
remark: null
}
export default {
name: 'WorkGood',
dicts: ['product_area'],
components: { pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '在制品统计',
optShow: { add: false, reset: true },
url: 'api/pdmBiWorkmaterial',
idField: 'id',
crudMethod: { ...workinggood }
})
},
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: [],
workList: [],
downloadLoading: false,
permission: {
add: ['admin', 'dept:add'],
edit: ['admin', 'dept:edit'],
del: ['admin', 'dept:del']
},
trueorfalse: [{ value: true, label: '是' }, { value: false, label: '否' }]
}
},
created() {
this.getWorkprocedure()
},
methods: {
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(() => { })
},
getWorkprocedure() { // 获取工序下拉框
crudDevice.getWorkprocedure().then(res => {
this.workList = res
})
},
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>

View File

@@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/pdmBiWorkmaterial',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/pdmBiWorkmaterial',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/pdmBiWorkmaterial',
method: 'put',
datas
})
}
export default { add, edit, del }