Files
lanzhouhailiang_one/lms/nladmin-ui/src/views/wms/st/outbill/index.vue
2022-11-27 15:41:57 +08:00

577 lines
21 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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-input
v-model="query.bill_code"
size="mini"
clearable
placeholder="出库单号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="所属仓库">
<el-select
v-model="query.stor_id"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="生成方式">
<el-select
v-model="query.create_mode"
clearable
size="mini"
placeholder="生成方式"
class="filter-item"
@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-select
v-model="query.bill_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.io_bill_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务类型">
<el-select
v-model="query.bill_type"
clearable
filterable
size="mini"
placeholder="业务类型"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.ST_INV_OUT_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="dis_flag"
@click="divOpen"
>
分配
</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
:disabled="work_flag"
icon="el-icon-position"
size="mini"
@click="taskOpen"
>
作业任务
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
:disabled="confirm_flag"
icon="el-icon-check"
size="mini"
@click="confirm"
>
强制确认
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
size="mini"
:data="crud.data"
style="width: 100%;"
:highlight-current-row="true"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column
v-permission="['admin','checkoutbill:del','checkoutbill:edit']"
label="操作"
width="250"
align="center"
fixed="right"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
style="display: inline"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
<el-button
type="text"
icon="el-icon-upload"
@click="openMoney(scope.row)"
>
发货信息
</el-button>
<el-button
type="text"
icon="el-icon-printer"
@click="printExcel(scope.row)"
>
打印
</el-button>
</template>
</el-table-column>
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="单据编码">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_code }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip :formatter="stateFormat" width="100" prop="bill_status" label="单据状态" />
<el-table-column prop="stor_name" label="仓库" width="100" />
<el-table-column show-overflow-tooltip prop="bill_type" :formatter="bill_typeFormat" label="业务类型" />
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
<el-table-column show-overflow-tooltip :formatter="create_modeFormat" prop="create_mode" label="生成方式" width="100" />
<el-table-column label="明细数" align="center" prop="detail_count" width="100" />
<el-table-column label="总重量" align="center" prop="total_qty" width="100" />
<el-table-column show-overflow-tooltip label="备注" align="center" prop="remark" width="100" />
<el-table-column show-overflow-tooltip label="制单人" align="center" prop="input_optname" />
<el-table-column show-overflow-tooltip label="制单时间" align="center" prop="input_time" width="140" />
<el-table-column show-overflow-tooltip label="修改人" align="center" prop="update_optname" />
<el-table-column show-overflow-tooltip label="修改时间" align="center" prop="update_time" width="140" />
<el-table-column show-overflow-tooltip label="分配人" align="center" prop="dis_optname" />
<el-table-column show-overflow-tooltip label="分配时间" align="center" prop="dis_time" width="140" />
<el-table-column show-overflow-tooltip label="确认人" align="center" prop="confirm_optname" />
<el-table-column show-overflow-tooltip label="确认时间" align="center" prop="confirm_time" width="140" />
</el-table>
<!--分页组件-->
<pagination />
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :rowmst="mstrow" @DivChanged="querytable" />
<TaskDialog :dialog-show.sync="taskShow" :open-array="openParam" :rowmst="mstrow" @TaskChanged="querytable" />
<MoneyDialog :dialog-show.sync="openMoneyDialog" :open-param="openParam" />
</div>
</template>
<script>
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
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 AddDialog from '@/views/wms/st/outbill/AddDialog'
import MoneyDialog from '@/views/wms/st/outbill/MoneyDialog'
import DivDialog from '@/views/wms/st/outbill/DivDialog'
import TaskDialog from '@/views/wms/st/outbill/TaskDialog'
import ViewDialog from '@/views/wms/st/outbill/ViewDialog'
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'Checkoutbill',
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DivDialog, TaskDialog, MoneyDialog },
cruds() {
return CRUD({ title: '用户', idField: 'iostorinv_id', url: 'api/checkoutbill', crudMethod: { ...checkoutbill },
optShow: {
add: true,
edit: false,
del: false,
reset: true,
download: false
}})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['io_bill_status', 'ST_CREATE_MODE', 'ST_INV_OUT_TYPE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
add: ['admin', 'checkoutbill:add'],
edit: ['admin', 'checkoutbill:edit'],
del: ['admin', 'checkoutbill:del']
},
openMoneyDialog: false,
divShow: false,
taskShow: false,
dis_flag: true,
work_flag: true,
confirm_flag: true,
openParam: [],
mstrow: {},
viewShow: false,
currentRow: null,
checkrows: [],
storlist: [],
billtypelist: []
}
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudStorattr.getStor({ 'is_productstore': '1' }).then(res => {
this.storlist = res.content
})
// crudRawAssist.getType({ 'io_code': '0101', 'io_flag': '01' }).then(res => {
// this.billtypelist = res
// })
},
methods: {
canUd(row) {
return row.bill_status !== '10'
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
[CRUD.HOOK.beforeRefresh]() {
this.handleCurrentChange(null)
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.buttonChange(row)
} else if (val.length === 1) {
this.buttonChange(row)
} else {
this.handleCurrentChange(null)
}
},
onSelectAll() {
this.$refs.table.clearSelection()
this.handleCurrentChange(null)
},
buttonChange(current) {
if (current !== null) {
this.currentRow = current
if (current.bill_status === '10' || current.bill_status === '30' || current.bill_status === '40') {
this.dis_flag = false
} else {
this.dis_flag = true
}
if (current.bill_status === '30' || current.bill_status === '40') {
this.work_flag = false
} else {
this.work_flag = true
}
if (current.bill_status === '50' || current.bill_status === '40') {
this.confirm_flag = false
} else {
this.confirm_flag = true
}
}
},
stateFormat(row) {
return this.dict.label.io_bill_status[row.bill_status]
},
bill_typeFormat(row) {
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type]
},
create_modeFormat(row) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
},
handleCurrentChange(current) {
if (current === null) {
this.dis_flag = true
this.confirm_flag = true
this.work_flag = true
this.currentRow = {}
}
},
checkboxT(row) {
return row.bill_status !== '99'
},
divOpen() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.openParam = res
this.divShow = true
this.mstrow = this.currentRow
})
},
taskOpen() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.openParam = res
this.taskShow = true
this.mstrow = this.currentRow
})
},
confirm() {
checkoutbill.confirm({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.querytable()
})
},
querytable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
},
openMoney(row) {
this.openParam = row
this.openMoneyDialog = true
},
print(jo) {
checkoutbill.getOutBillDtl({ 'iostorinv_id': jo.iostorinv_id }).then(res => {
var total_array = []
for (var i = 0; i < res.length; i++) {
var jre = res[i]
var single_array = []
single_array.push(jre.seq_no)
single_array.push(jre.source_bill_code)
single_array.push(jre.material_name)
single_array.push(jre.material_spec)
single_array.push(jre.qty_unit_name)
single_array.push(jre.plan_qty)
single_array.push(jre.remark)
total_array.push(single_array)
}
// 对total_array进行分页每40条数据分为一页
var page = Math.ceil(total_array.length / 10) // 页数,向上取整
var left = parseInt(total_array.length % 10) // 最后一页条数
// 组织打印格式
var jastr = []
jastr[0] = this.print_getTableHtml({
heads: [{ width: '50px', name: '序号', colname: '0' },
{ width: '135px', name: '订单号', colname: '1' },
{ width: '250px', name: '物料名称', colname: '2' },
{ width: '60px', name: '型号规格', colname: '3' },
{ width: '60px', name: '单位', colname: '4' },
{ width: '100px', name: '数量', colname: '5' },
{ width: '50px', name: '备注', colname: '6' }
],
rows: total_array
})
jo.lastSize = left + 2 // 最后一页的数据量加2个单位显示生成人等字段
this.print2(jastr, jo)
alert('打印成功!')
})
},
print2(jastr, jo) {
debugger
var LODOP = getLodop()
// for循环
var num = jastr.length
LODOP.ADD_PRINT_TABLE('28%', 0, '100%', '100%', jastr[0])
LODOP.ADD_PRINT_HTM('10%', '5%', '100%', '100%', '地址:' + jo.deliveryaddress)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -1)
LODOP.ADD_PRINT_HTM('10%', '40%', '100%', '100%', '联系人:' + jo.deliveryname)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -2)
LODOP.ADD_PRINT_HTM('10%', '70%', '100%', '100%', '联系电话:' + jo.deliveryphone)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -3)
LODOP.ADD_PRINT_HTM('15%', '5%', '100%', '100%', '仓储:______________')
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -4)
LODOP.ADD_PRINT_HTM('15%', '40%', '100%', '100%', '财务部:______________')
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -5)
LODOP.ADD_PRINT_HTM('15%', '70%', '100%', '100%', '司机签字:______________')
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -6)
LODOP.ADD_PRINT_HTM('20%', '5%', '100%', '100%', '客户(签字盖章):______________')
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', -7)
// 另起一页
LODOP.SET_PRINT_STYLE('FontSize', 17)
LODOP.SET_PRINT_STYLE('Bold', 1)
LODOP.ADD_PRINT_TEXT('-7%', '30%', '100%', '100%', '甘肃海亮新能源材料有限公司')
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.SET_PRINT_STYLE('FontSize', 15)
LODOP.SET_PRINT_STYLE('Bold', 1)
LODOP.ADD_PRINT_TEXT('-1%', '45%', '100%', '100%', '送货单')
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
// 画线
// LODOP.ADD_PRINT_LINE('0%', '10%', '10%', '100%', 0, 1)
LODOP.ADD_PRINT_HTM('3%', '5%', '100%', '100%', '实际发货日期:' + jo.biz_date)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('3%', '70%', '100%', '100%', '送货单号:' + jo.bill_code)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('7%', '5%', '100%', '100%', '收货单位:' + jo.consignee)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('7%', '70%', '100%', '100%', '收货人:' + jo.receiver)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('11%', '5%', '100%', '100%', '收货地址:' + jo.receiptaddress)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('11%', '70%', '100%', '100%', '联系电话:' + jo.receiptphone)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('15%', '5%', '100%', '100%', '物流公司:' + jo.logisticscompany)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('15%', '70%', '100%', '100%', '司机:' + jo.drivername)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('19%', '5%', '100%', '100%', '车牌号:' + jo.carno)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('19%', '70%', '100%', '100%', '联系电话:' + jo.driverphone)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('23%', '5%', '100%', '100%', '合同号:' + jo.contractno)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('23%', '45%', '100%', '100%', '总箱数:' + jo.num)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.ADD_PRINT_HTM('23%', '70%', '100%', '100%', '总毛重:' + jo.total_qty)
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1)
LODOP.NEWPAGE()
LODOP.SET_PRINT_STYLE('FontSize', 12)
LODOP.SET_PRINT_STYLE('Bold', 0)
LODOP.ADD_PRINT_TEXT('6%', '69%', 165, 22, '页码:[第#页/共&页]')
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 2)
//
// LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
// LODOP.PRINT();
LODOP.PREVIEWA()
},
print_getTableHtml(jparam) {
var _heads = jparam.heads
var _rows = jparam.rows
var _foothtml = jparam.foothtml
var strStyle = '<style> table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>'
var arr = []
arr.push('<table border=1 cellSpacing=0 cellPadding=1 width=\'100%\' style=\'border-collapse:collapse;font-size:13px\' bordercolor=\'#333333\'>')
arr.push(' <thead>')
arr.push(' <tr>')
for (var i = 0; i < _heads.length; i++) {
var head = _heads[i]
arr.push(' <td width=\'' + head.width + '\'>')
arr.push(' <div align=center><b>' + head.name + '</b></div>')
arr.push(' </td>')
}
arr.push(' </tr>')
arr.push(' </thead>')
arr.push(' <tbody>')
for (var i = 0; i < _rows.length; i++) {
var row = _rows[i]
arr.push(' <tr>')
for (var j = 0; j < _heads.length; j++) {
var head = _heads[j]
arr.push(' <td align=center>' + row[head.colname] + '</td>')
}
arr.push(' </tr>')
}
arr.push(' </tbody>')
if (_foothtml) {
arr.push(' <tfoot>' + _foothtml + '</tfoot>')
}
arr.push('</table>')
return strStyle + arr.join('')
},
printExcel(jo) {
if (jo.shd_dtl_num === '') {
return this.crud.notify('客户为空!', CRUD.NOTIFICATION_TYPE.INFO)
}
checkoutbill.getDisNum({ 'iostorinv_id': jo.iostorinv_id }).then(res => {
const j = Math.ceil(res.num / jo.shd_dtl_num)
debugger
for (let i = 0; i < j; i++) {
download('/api/checkoutbill/downloadExcel', { 'iostorinv_id': jo.iostorinv_id, 'j': i, 'pageNum': j }).then(result => {
downloadFile(result, '发货单', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>