<script setup>
|
|
import {reactive, ref} from "vue";
|
import {useRouter} from 'vue-router'
|
import request from "@/utils/request";
|
import deepClone from "@/utils/deepClone";
|
import {ElMessage} from "element-plus";
|
let router=useRouter()
|
let produceList = ref([])
|
const getTableRow = (row,type) =>{
|
switch (type) {
|
case 'edit' :{
|
//alert('我接收到子组件传送的编辑信息')
|
router.push({path: '/main/productStock/OrderAllocation', query: { id: row.id }})
|
break
|
}
|
case 'back':{
|
router.push({path: '/main/productStock/FinishedProductRework', query: { id: row.id }})
|
break
|
}
|
case 'out' :{
|
//alert('我接收到子组件传送的编辑信息')
|
router.push({path: '/main/productStock/FinishedGoodsIssue', query: { id: row.id }})
|
break
|
}
|
}
|
}
|
|
const hasDecimal=(value)=>{
|
const regex=/\./ // 定义正则表达式,查找小数点
|
return regex.test(value) //返回true/false
|
}
|
|
const hasDecimalhtml=(item,row)=>{
|
let aa=item.split('.').length
|
if (aa===2){
|
return row[item.split('.')[0]][item.split('.')[1]]
|
}else if(aa===3){
|
return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]]
|
}
|
|
|
}
|
|
|
request.get("/FinishedGoodsInventory/getselet/1/100").then((res) => {
|
if(res.code==200){
|
console.log(res.data)
|
produceList = produceList.value.concat(deepClone(res.data))
|
|
xGrid.value.reloadData(produceList)
|
gridOptions.loading=false
|
}else{
|
ElMessage.warning(res.msg)
|
router.push("/login")
|
}
|
})
|
|
|
|
//子组件接收参数
|
|
const gridOptions = reactive({
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe:true,//斑马纹
|
rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
|
id: 'CustomerList',
|
showFooter: true,//显示脚
|
printConfig: {},
|
importConfig: {},
|
exportConfig: {},
|
scrollY:{ enabled: true },//开启虚拟滚动
|
showOverflow:true,
|
columnConfig: {
|
resizable: true,
|
useKey: true
|
},
|
filterConfig: { //筛选配置项
|
remote: true
|
},
|
customConfig: {
|
storage: true
|
},
|
editConfig: {
|
trigger: 'click',
|
mode: 'row',
|
showStatus: true
|
},//表头参数
|
columns:[
|
{type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
|
// { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
|
{ type: 'seq',fixed:"left", title: '自序', width: '80' },
|
// {title: '操作', width: '220', slots: { default: 'button_slot' },fixed:"left"},
|
{field: 'orderDetail.orderNumber', width:'150', title: '订单序号', filters:[{ data: '' }],editRender: { name: 'input', attrs: { placeholder: '' } } },
|
{field: 'order.orderId', width: '150',title: '销售单号',showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
|
{field: 'order.project', width: '120',title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
|
{field: 'order.orderType', width: '100',title: '订单类型', filters:[{ data: '' }]},
|
{field: 'orderDetail.product.productName', width: '100',title: '产品名称', filters:[{ data: '' }]},
|
{field: 'orderDetail.product.id',width: '100', title: '产品编号', filters:[{ data: '' }]},
|
|
{field: 'orderDetail.width', width: '100',title: '宽度',filters:[{ data: '' }]},
|
{field: 'orderDetail.height',width: '100', title: '高度', filters:[{ data: '' }]},
|
{field: 'inventory',width: '140', title: '库存数量', filters:[{ data: '' }]},
|
{field: 'quantityAvailable',width: '140', title: '可用数量', filters:[{ data: '' }]},
|
|
{field: 'actualSignalArea',width: '140', title: '实际单片面积', filters:[{ data: '' }]},
|
{field: 'area',width: '100', title: '总面积', filters:[{ data: '' }]},
|
|
{field: 'warehouseNumber',width: '100', title: '仓库编号', filters:[{ data: '' }]},
|
{field: 'storageRegion',width: '100', title: '库存区域', filters:[{ data: '' }]},
|
{field: 'status',width: '100', title: '状态', filters:[{ data: '' }]},
|
|
{field: 'enterStorageTime',width: '140', title: '入库时间', filters:[{ data: '' }]},
|
{field: 'updateTime',width: '140', title: '修改时间', filters:[{ data: '' }]},
|
{field: 'endTime',width: '100', title: '出库时间', filters:[{ data: '' }]},
|
{field: 'remark',width: '80', title: '备注', filters:[{ data: '' }]},
|
],//表头按钮
|
toolbarConfig: {
|
buttons: [
|
{ 'code' :'issue','name':'订单调拨',status: 'primary'},
|
{ 'code' :'out','name':'成品领出',status: 'primary'},
|
{ 'code' :'rework','name':'成品返工',status: 'primary'},
|
|
],
|
import: false,
|
export: true,
|
print: true,
|
zoom: true,
|
custom: true
|
},
|
footerMethod ({ columns, data }) {//页脚函数
|
return[
|
columns.map((column, columnIndex) => {
|
if (columnIndex === 0) {
|
return '合计:'
|
}
|
// if (props.tableProp.footList.includes(column.field)) {
|
// return sumNum(data, column.field)
|
// }
|
return ''
|
})
|
]
|
}
|
|
})
|
const xGrid = ref();
|
const gridEvents = {
|
toolbarButtonClick({ code }) {
|
const $grid = xGrid.value
|
if($grid){
|
switch (code){
|
case 'issue':{
|
/*VXETable.modal.confirm('点击了库存调拨');*/
|
router.push({path: '/main/productStock/OrderAllocation'});
|
return;
|
break
|
}
|
case 'out':{
|
router.push({path: '/main/productStock/FinishedGoodsIssue'});
|
return;
|
break;
|
}
|
case 'rework':{
|
router.push({path: '/main/productStock/FinishedProductRework'});
|
return;
|
break;
|
}
|
}
|
}
|
}
|
}
|
|
|
</script>
|
|
<template>
|
<div class="main-div-customer">
|
<vxe-grid
|
max-height="100%"
|
@filter-change="filterChanged"
|
class="mytable-scrollbar"
|
ref="xGrid"
|
v-bind="gridOptions"
|
v-on="gridEvents"
|
|
>
|
<!-- @toolbar-button-click="toolbarButtonClickEvent"-->
|
<!-- 下拉显示所有信息插槽-->
|
<template #content="{ row }">
|
<ul class="expand-wrapper">
|
<li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
|
<span style="font-weight: bold">{{item.title+': '}}</span>
|
<span v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span>
|
<span v-else>{{ row[item.field] }}</span>
|
</li>
|
</ul>
|
</template>
|
|
<!--左边固定显示的插槽-->
|
<template #button_slot="{ row }">
|
<!-- <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">订单调拨</el-button>-->
|
<!-- <el-button @click="getTableRow(row,'out')" link type="primary" size="small">成品领出</el-button>-->
|
<!-- <el-button @click="getTableRow(row,'back')" link type="primary" size="small">成品返工</el-button>-->
|
</template>
|
|
<template #num1_filter="{ column, $panel }">
|
<div>
|
<div v-for="(option, index) in column.filters" :key="index">
|
<input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
|
</div>
|
</div>
|
</template>
|
|
|
</vxe-grid>
|
</div>
|
</template>
|
|
<style scoped>
|
.main-div-customer{
|
width: 99%;
|
height: 100%;
|
}
|
</style>
|