330 lines
11 KiB
Vue
330 lines
11 KiB
Vue
<!--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=":"
|
||
label-width="80px"
|
||
>
|
||
|
||
<el-form-item label="车间">
|
||
<el-select
|
||
v-model="query.workshop_id"
|
||
class="filter-item"
|
||
clearable
|
||
placeholder="全部"
|
||
size="mini"
|
||
@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="结束日期"
|
||
start-placeholder="开始日期"
|
||
type="daterange"
|
||
value-format="yyyy-MM-dd"
|
||
@change="crud.toQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="状态">
|
||
<el-select
|
||
v-model="query.bill_status"
|
||
class="filter-item"
|
||
clearable
|
||
placeholder="单据状态"
|
||
size="mini"
|
||
@change="crud.toQuery"
|
||
>
|
||
<el-option
|
||
v-for="item in dict.PURCHASE_STATUS"
|
||
: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"
|
||
class="filter-item"
|
||
clearable
|
||
filterable
|
||
placeholder="生成方式"
|
||
size="mini"
|
||
@change="crud.toQuery"
|
||
>
|
||
<el-option
|
||
v-for="item in dict.ST_CREATE_MODE"
|
||
: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="编码、名称"
|
||
size="mini"
|
||
@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"
|
||
type="success"
|
||
@click="downdtl"
|
||
>
|
||
导出EXCEL
|
||
</el-button>
|
||
<el-button
|
||
slot="right"
|
||
class="filter-item"
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
type="success"
|
||
@click="uploadShow = true"
|
||
>
|
||
导入EXCEL
|
||
</el-button>
|
||
<el-button
|
||
slot="right"
|
||
:disabled="crud.selections.length !== 1"
|
||
class="filter-item"
|
||
icon="el-icon-finished"
|
||
size="mini"
|
||
type="success"
|
||
@click="crud.toEdit(crud.selections[0])"
|
||
>
|
||
确认采购
|
||
</el-button>
|
||
<el-button
|
||
slot="right"
|
||
:disabled="crud.selections.length === 0"
|
||
class="filter-item" icon="el-icon-check"
|
||
size="mini"
|
||
type="success"
|
||
Ï
|
||
@click="confirm(crud.selections)"
|
||
>
|
||
强制完成
|
||
</el-button>
|
||
</crudOperation>
|
||
<!--表格渲染-->
|
||
<el-table
|
||
ref="table"
|
||
v-loading="crud.loading"
|
||
:data="crud.data"
|
||
:row-class-name="tableRowClassName"
|
||
:summary-method="getSummaries"
|
||
highlight-current-row
|
||
show-summary
|
||
size="mini"
|
||
style="width: 100%;"
|
||
@select-all="crud.selectAllChange"
|
||
@selection-change="crud.selectionChangeHandler"
|
||
>
|
||
<el-table-column type="selection" width="55"/>
|
||
<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/>
|
||
<!-- <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 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"/>
|
||
<!-- <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>
|
||
<style>
|
||
.el-table .red-row {
|
||
background-color: red;
|
||
}
|
||
</style>
|
||
<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/purchaseplan/AddDialog'
|
||
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||
import { download } from '@/api/data'
|
||
import { downloadFile } from '@/utils'
|
||
import UploadDialog from '@/views/wms/pcs/purchaseplan/UploadDialog'
|
||
|
||
export default {
|
||
name: 'PurchasePlan',
|
||
components: { UploadDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
||
cruds() {
|
||
return CRUD({
|
||
title: '',
|
||
optShow: { reset: true },
|
||
idField: 'id,desc',
|
||
query: {
|
||
'status': '1'
|
||
},
|
||
url: '/api/pcsIfPurchaseorder',
|
||
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: [],
|
||
uploadShow: false,
|
||
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: {
|
||
//确认时间比需求时间晚,预警
|
||
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 = []
|
||
columns.forEach((column, index) => {
|
||
if (index === 0) {
|
||
sums[index] = '合计'
|
||
return
|
||
}
|
||
const values = data.map(item => Number(item[column.property]))
|
||
if (column.property === 'show_qty' || column.property === 'instor_qty') {
|
||
sums[index] = values.reduce((prev, curr) => {
|
||
const value = Number(curr)
|
||
if (!isNaN(value)) {
|
||
return prev + curr
|
||
} else {
|
||
return prev
|
||
}
|
||
}, 0)
|
||
sums[index] = sums[index].toFixed(3) + ' KG'
|
||
}
|
||
})
|
||
return sums
|
||
},
|
||
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 => {
|
||
|
||
downloadFile(result, '原料需求', 'xlsx')
|
||
crud.downloadLoading = false
|
||
}).catch(() => {
|
||
crud.downloadLoading = false
|
||
})
|
||
},
|
||
confirm(rows) {
|
||
crudPurchase.confirm(rows).then(res => {
|
||
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||
this.crud.toQuery()
|
||
})
|
||
}
|
||
,
|
||
stateFormat(row, column) {
|
||
return this.dict.label.PURCHASE_STATUS[row.status]
|
||
}
|
||
,
|
||
workshopFormat(row, column) {
|
||
return this.dict.label.product_area[row.workshop_id]
|
||
}
|
||
,
|
||
createModeFormat(row, column) {
|
||
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||
}
|
||
,
|
||
querytable() {
|
||
this.onSelectAll()
|
||
this.crud.toQuery()
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style lang="scss" rel="stylesheet/scss" scoped>
|
||
::v-deep .el-dialog__body {
|
||
padding-top: 10px;
|
||
}
|
||
</style>
|