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-22 13:55:06 +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-22 13:55:06 +08:00
|
|
|
|
class="filter-item"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="全部"
|
2023-09-22 13:55:06 +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"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
end-placeholder="结束日期"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@change="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="状态">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="query.bill_status"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
class="filter-item"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="单据状态"
|
2023-09-22 13:55:06 +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.PURCHASE_STATUS"
|
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-select
|
|
|
|
|
|
v-model="query.create_mode"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
class="filter-item"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
filterable
|
|
|
|
|
|
placeholder="生成方式"
|
2023-09-22 13:55:06 +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-22 13:55:06 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@keyup.enter.native="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<rrOperation/>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
|
|
|
|
<crudOperation :permission="permission">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
slot="right"
|
|
|
|
|
|
class="filter-item"
|
|
|
|
|
|
icon="el-icon-upload2"
|
|
|
|
|
|
size="mini"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
type="success"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@click="downdtl"
|
|
|
|
|
|
>
|
|
|
|
|
|
导出EXCEL
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
slot="right"
|
|
|
|
|
|
class="filter-item"
|
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
|
size="mini"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
type="success"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
@click="uploadShow = true"
|
|
|
|
|
|
>
|
|
|
|
|
|
导入EXCEL
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
slot="right"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
:disabled="crud.selections.length !== 1"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
class="filter-item"
|
|
|
|
|
|
icon="el-icon-finished"
|
|
|
|
|
|
size="mini"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
type="success"
|
2023-06-30 10:23:26 +08:00
|
|
|
|
@click="crud.toEdit(crud.selections[0])"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
>
|
|
|
|
|
|
确认采购
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
slot="right"
|
|
|
|
|
|
:disabled="crud.selections.length === 0"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
class="filter-item" icon="el-icon-check"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
size="mini"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
type="success"
|
|
|
|
|
|
Ï
|
2023-06-30 10:23:26 +08:00
|
|
|
|
@click="confirm(crud.selections)"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
>
|
|
|
|
|
|
强制完成
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</crudOperation>
|
|
|
|
|
|
<!--表格渲染-->
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
ref="table"
|
|
|
|
|
|
v-loading="crud.loading"
|
|
|
|
|
|
:data="crud.data"
|
2023-09-22 13:55:06 +08:00
|
|
|
|
:row-class-name="tableRowClassName"
|
|
|
|
|
|
:summary-method="getSummaries"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
highlight-current-row
|
|
|
|
|
|
show-summary
|
2023-09-22 13:55:06 +08:00
|
|
|
|
size="mini"
|
2023-06-29 18:35:44 +08:00
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
@select-all="crud.selectAllChange"
|
|
|
|
|
|
@selection-change="crud.selectionChangeHandler"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column type="selection" width="55"/>
|
2023-09-22 13:55:06 +08:00
|
|
|
|
<el-table-column :formatter="workshopFormat" label="车间" prop="workshop_id" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column label="物料编号" prop="material_code" show-overflow-tooltip width="130"/>
|
|
|
|
|
|
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip width="130"/>
|
|
|
|
|
|
<el-table-column label="要求到货日期" prop="askTime" show-overflow-tooltip width="130"/>
|
|
|
|
|
|
<el-table-column label="重量" min-width="120" prop="show_qty" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column label="确认交货日期" min-width="120" prop="agree_time" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column label="订单编号" min-width="120" prop="po_code" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column label="入库重量" min-width="120" prop="instor_qty" show-overflow-tooltip/>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
<!-- <el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="安全库存" />-->
|
|
|
|
|
|
<!-- <el-table-column label="总重量" align="center" prop="total_qty"/>-->
|
2023-09-22 13:55:06 +08:00
|
|
|
|
<el-table-column :formatter="stateFormat" align="center" label="状态" prop="status"/>
|
|
|
|
|
|
<el-table-column align="center" label="备注" prop="remark"/>
|
|
|
|
|
|
<el-table-column :formatter="createModeFormat" align="center" label="生成方式" min-width="100" prop="create_mode"/>
|
|
|
|
|
|
<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="audit_name" width="150"/>
|
|
|
|
|
|
<el-table-column align="center" label="提交时间" prop="audit_time" width="140px"/>
|
|
|
|
|
|
<el-table-column align="center" label="采购确认人" prop="purchase_name" width="150"/>
|
|
|
|
|
|
<el-table-column align="center" label="采购确认时间" prop="purchase_time" width="140px"/>
|
|
|
|
|
|
<el-table-column align="center" label="完成人" prop="confirm_name" width="150"/>
|
|
|
|
|
|
<el-table-column align="center" label="完成时间" prop="confirm_time" width="140px"/>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
<!-- <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<udOperation
|
|
|
|
|
|
:data="scope.row"
|
|
|
|
|
|
:permission="permission"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>-->
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<!--分页组件-->
|
|
|
|
|
|
<pagination/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<AddDialog @AddChanged="querytable"/>
|
|
|
|
|
|
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2023-09-22 13:55:06 +08:00
|
|
|
|
<style>
|
|
|
|
|
|
.el-table .red-row {
|
|
|
|
|
|
background-color: red;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
2023-06-29 18:35:44 +08:00
|
|
|
|
<script>
|
|
|
|
|
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
2023-09-22 13:55:06 +08:00
|
|
|
|
import CRUD, { crud, header, presenter } from '@crud/crud'
|
2023-06-29 18:35:44 +08:00
|
|
|
|
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'
|
2023-06-30 10:23:26 +08:00
|
|
|
|
import AddDialog from '@/views/wms/pcs/purchaseplan/AddDialog'
|
2023-06-29 18:35:44 +08:00
|
|
|
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
|
|
|
|
|
import { download } from '@/api/data'
|
|
|
|
|
|
import { downloadFile } from '@/utils'
|
2023-09-22 13:55:06 +08:00
|
|
|
|
import UploadDialog from '@/views/wms/pcs/purchaseplan/UploadDialog'
|
2023-06-29 18:35:44 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'PurchasePlan',
|
2023-09-22 13:55:06 +08:00
|
|
|
|
components: { UploadDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
2023-06-29 18:35:44 +08:00
|
|
|
|
cruds() {
|
|
|
|
|
|
return CRUD({
|
|
|
|
|
|
title: '',
|
2023-09-22 13:55:06 +08:00
|
|
|
|
optShow: { reset: true },
|
2023-06-30 10:23:26 +08:00
|
|
|
|
idField: 'id,desc',
|
2023-06-29 18:35:44 +08:00
|
|
|
|
query: {
|
|
|
|
|
|
'status': '1'
|
|
|
|
|
|
},
|
|
|
|
|
|
url: '/api/pcsIfPurchaseorder',
|
2023-09-22 13:55:06 +08:00
|
|
|
|
crudMethod: { ...crudPurchase }
|
2023-06-29 18:35:44 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
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: [],
|
|
|
|
|
|
uploadShow: false,
|
|
|
|
|
|
currentRow: null,
|
|
|
|
|
|
storlist: [],
|
|
|
|
|
|
storId: null
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-09-22 13:55:06 +08:00
|
|
|
|
mounted: function() {
|
2023-06-29 18:35:44 +08:00
|
|
|
|
const that = this
|
|
|
|
|
|
window.onresize = function temp() {
|
|
|
|
|
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
crudStorattr.getStor({ 'stor_type': '3' }).then(res => {
|
2023-06-29 18:35:44 +08:00
|
|
|
|
this.storlist = res.content
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
//确认时间比需求时间晚,预警
|
|
|
|
|
|
tableRowClassName({ row }) {
|
|
|
|
|
|
const askTime = row.askTime
|
|
|
|
|
|
const agreeTime = row.agree_time
|
|
|
|
|
|
if (askTime && agreeTime) {
|
|
|
|
|
|
return new Date(agreeTime) > new Date(askTime) ? 'red-row' : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
getSummaries(param) {
|
|
|
|
|
|
const { columns, data } = param
|
|
|
|
|
|
const sums = []
|
2023-06-29 18:35:44 +08:00
|
|
|
|
columns.forEach((column, index) => {
|
|
|
|
|
|
if (index === 0) {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
sums[index] = '合计'
|
|
|
|
|
|
return
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-22 13:55:06 +08:00
|
|
|
|
const values = data.map(item => Number(item[column.property]))
|
2023-09-18 13:26:48 +08:00
|
|
|
|
if (column.property === 'show_qty' || column.property === 'instor_qty') {
|
2023-06-29 18:35:44 +08:00
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
const value = Number(curr)
|
2023-06-29 18:35:44 +08:00
|
|
|
|
if (!isNaN(value)) {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
return prev + curr
|
2023-06-29 18:35:44 +08:00
|
|
|
|
} else {
|
2023-09-22 13:55:06 +08:00
|
|
|
|
return prev
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-22 13:55:06 +08:00
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + ' KG'
|
2023-06-29 18:35:44 +08:00
|
|
|
|
}
|
2023-09-22 13:55:06 +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]
|
|
|
|
|
|
},
|
|
|
|
|
|
downdtl() {
|
|
|
|
|
|
crud.downloadLoading = true
|
|
|
|
|
|
download('/api/pcsIfPurchaseorder/download', this.crud.query
|
|
|
|
|
|
).then(result => {
|
2023-09-18 10:12:12 +08:00
|
|
|
|
|
2023-06-29 18:35:44 +08:00
|
|
|
|
downloadFile(result, '原料需求', 'xlsx')
|
|
|
|
|
|
crud.downloadLoading = false
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
crud.downloadLoading = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-06-30 10:23:26 +08:00
|
|
|
|
confirm(rows) {
|
|
|
|
|
|
crudPurchase.confirm(rows).then(res => {
|
2023-06-29 18:35:44 +08:00
|
|
|
|
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
,
|
|
|
|
|
|
stateFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.PURCHASE_STATUS[row.status]
|
|
|
|
|
|
}
|
|
|
|
|
|
,
|
2023-09-22 13:55:06 +08:00
|
|
|
|
workshopFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.product_area[row.workshop_id]
|
|
|
|
|
|
}
|
|
|
|
|
|
,
|
2023-06-29 18:35:44 +08:00
|
|
|
|
createModeFormat(row, column) {
|
|
|
|
|
|
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
|
|
|
|
|
}
|
|
|
|
|
|
,
|
|
|
|
|
|
querytable() {
|
|
|
|
|
|
this.onSelectAll()
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2023-09-22 13:55:06 +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>
|