2023-06-29 18:35:44 +08:00
|
|
|
|
<!--suppress ALL -->
|
|
|
|
|
|
<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-suffix=":"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
label-width="80px"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="车间">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="query.workshop_id"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
class="filter-item"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="全部"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +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.createTime"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
:default-time="['00:00:00', '23:59:59']"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
align="center"
|
|
|
|
|
|
end-placeholder="结束日期"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@change="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="生成方式">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="query.create_mode"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
class="filter-item"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
filterable
|
|
|
|
|
|
placeholder="生成方式"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@change="crud.toQuery"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
2023-09-18 13:26:48 +08:00
|
|
|
|
v-for="item in dict.ST_CREATE_MODE"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
:key="item.value"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:value="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="物料">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="query.material_search"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="编码、名称"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@keyup.enter.native="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<rrOperation/>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
|
|
|
|
<crudOperation :permission="permission">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
slot="right"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
:disabled="crud.selections.length === 0"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
class="filter-item"
|
|
|
|
|
|
icon="el-icon-check"
|
|
|
|
|
|
size="mini"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
type="warning"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@click="commit(crud.selections)"
|
|
|
|
|
|
>
|
|
|
|
|
|
提交采购
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</crudOperation>
|
|
|
|
|
|
<!--表格渲染-->
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
ref="table"
|
|
|
|
|
|
v-loading="crud.loading"
|
|
|
|
|
|
:data="crud.data"
|
2023-09-18 13:26:48 +08:00
|
|
|
|
:summary-method="getSummaries"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
highlight-current-row
|
|
|
|
|
|
show-summary
|
2023-09-18 13:26:48 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
@select-all="crud.selectAllChange"
|
|
|
|
|
|
@selection-change="crud.selectionChangeHandler"
|
|
|
|
|
|
>
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<el-table-column type="selection" width="55"/>
|
|
|
|
|
|
<el-table-column label="车间" prop="workshop_id" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column label="物料编号" prop="material_code" show-overflow-tooltip width="130"/>
|
|
|
|
|
|
<el-table-column :min-width="flexWidth('material_name', crud.data, '物料名称')" label="物料名称" prop="material_name" show-overflow-tooltip/>
|
2023-10-08 13:25:08 +08:00
|
|
|
|
<el-table-column label="要求到货日期" prop="askTime" show-overflow-tooltip width="150"/>
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<el-table-column label="重量" min-width="120" prop="show_qty" show-overflow-tooltip/>
|
|
|
|
|
|
<!-- <el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="安全库存" />-->
|
|
|
|
|
|
<!-- <el-table-column label="总重量" align="center" prop="total_qty"/>-->
|
|
|
|
|
|
<el-table-column :formatter="stateFormat" align="center" label="状态" prop="status"/>
|
|
|
|
|
|
<el-table-column :formatter="createModeFormat" align="center" label="生成方式" prop="create_mode" width="110"/>
|
|
|
|
|
|
<el-table-column align="center" label="创建人" prop="create_name" width="150"/>
|
|
|
|
|
|
<el-table-column align="center" label="创建时间" prop="createTime" width="150"/>
|
|
|
|
|
|
<el-table-column align="center" label="备注" prop="remark"/>
|
|
|
|
|
|
<el-table-column v-permission="[]" align="center" fixed="right" label="操作" width="120px">
|
2023-06-29 18:35:44 +08:00
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<udOperation
|
|
|
|
|
|
:data="scope.row"
|
|
|
|
|
|
:permission="permission"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<!--分页组件-->
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<pagination/>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
</div>
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<AddDialog @AddChanged="querytable"/>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
|
|
|
|
|
import CRUD, { crud, header, presenter } from '@crud/crud'
|
|
|
|
|
|
import rrOperation from '@crud/RR.operation'
|
|
|
|
|
|
import crudOperation from '@crud/CRUD.operation'
|
|
|
|
|
|
import udOperation from '@crud/UD.operation'
|
|
|
|
|
|
import pagination from '@crud/Pagination'
|
|
|
|
|
|
import DateRangePicker from '@/components/DateRangePicker/index'
|
|
|
|
|
|
import AddDialog from '@/views/wms/pcs/purchaseorder/AddDialog'
|
|
|
|
|
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'PurchaseOrder',
|
|
|
|
|
|
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
|
|
|
|
|
cruds() {
|
|
|
|
|
|
return CRUD({
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
optShow: { add: true, reset: true },
|
|
|
|
|
|
idField: 'id',
|
|
|
|
|
|
query: {
|
|
|
|
|
|
'status': '0'
|
|
|
|
|
|
},
|
2023-09-18 13:26:48 +08:00
|
|
|
|
url: '/api/pcsIfPurchaseorder/query',
|
2023-06-29 18:35:44 +08:00
|
|
|
|
crudMethod: { ...crudPurchase }
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
mixins: [presenter(), header(), crud()],
|
|
|
|
|
|
// 数据字典
|
|
|
|
|
|
dicts: ['PURCHASE_STATUS', 'product_area', 'ST_CREATE_MODE'],
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
height: document.documentElement.clientHeight - 180 + 'px;',
|
|
|
|
|
|
permission: {},
|
|
|
|
|
|
disShow: false,
|
|
|
|
|
|
viewShow: false,
|
|
|
|
|
|
mstrow: {},
|
|
|
|
|
|
divShow: false,
|
|
|
|
|
|
openParam: [],
|
|
|
|
|
|
currentRow: null,
|
|
|
|
|
|
storlist: [],
|
|
|
|
|
|
storId: null
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted: function() {
|
|
|
|
|
|
const that = this
|
|
|
|
|
|
window.onresize = function temp() {
|
|
|
|
|
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
crudStorattr.getStor({ 'stor_type': '3' }).then(res => {
|
|
|
|
|
|
this.storlist = res.content
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getSummaries(param) {
|
2023-09-18 13:26:48 +08:00
|
|
|
|
const { columns, data } = param
|
|
|
|
|
|
const sums = []
|
2023-06-29 18:35:44 +08:00
|
|
|
|
columns.forEach((column, index) => {
|
|
|
|
|
|
if (index === 0) {
|
2023-09-18 13:26:48 +08:00
|
|
|
|
sums[index] = '合计'
|
|
|
|
|
|
return
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-18 13:26:48 +08:00
|
|
|
|
const values = data.map(item => Number(item[column.property]))
|
|
|
|
|
|
if (column.property === 'show_qty') {
|
2023-06-29 18:35:44 +08:00
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
2023-09-18 13:26:48 +08:00
|
|
|
|
const value = Number(curr)
|
2023-06-29 18:35:44 +08:00
|
|
|
|
if (!isNaN(value)) {
|
2023-09-18 13:26:48 +08:00
|
|
|
|
return prev + curr
|
2023-06-29 18:35:44 +08:00
|
|
|
|
} else {
|
2023-09-18 13:26:48 +08:00
|
|
|
|
return prev
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-18 13:26:48 +08:00
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + ' KG'
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-18 13:26:48 +08:00
|
|
|
|
})
|
|
|
|
|
|
return sums
|
2023-06-29 18:35:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
bill_typeFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.ST_INV_RAW_IN_TYPE[row.bill_type]
|
|
|
|
|
|
},
|
|
|
|
|
|
commit(rows) {
|
|
|
|
|
|
crudPurchase.commit(rows).then(res => {
|
|
|
|
|
|
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
stateFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.PURCHASE_STATUS[row.status]
|
|
|
|
|
|
},
|
|
|
|
|
|
createModeFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
|
|
|
|
|
},
|
|
|
|
|
|
querytable() {
|
|
|
|
|
|
this.onSelectAll()
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2023-09-18 13:26:48 +08:00
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
::v-deep .el-dialog__body {
|
|
|
|
|
|
padding-top: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|