<script setup>
|
|
import request from "@/utils/request"
|
import deepClone from "@/utils/deepClone"
|
import {ElDatePicker, ElMessage} from "element-plus"
|
import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
|
import {useRouter} from 'vue-router'
|
import {useI18n} from 'vue-i18n'
|
import {changeFilterEvent, filterChanged} from "@/hook"
|
import {VXETable} from "vxe-table";
|
import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
|
import PrintProcess from '@/views/pp/processCard/PrintProcess.vue'
|
import PrintLabel from '@/views/pp/processCard/PrintLabel.vue'
|
import footSum from "@/hook/footSum"
|
//语言获取
|
const {t} = useI18n()
|
let router = useRouter()
|
const dialogTableVisible = ref(false)
|
const dialogTableVisibleLabel = ref(false)
|
const printVisible= ref(false)
|
const dialogTableVisibleSetup = ref(false)
|
let selectRecords = ref(null)
|
|
const xGrid = ref(null)
|
const xGridDetail =ref(null)
|
|
|
|
const getTableRow = (row,type) =>{
|
switch (type) {
|
case 'edit' :{
|
request.post(`/processCard/printFlowCardDetails/${row.process_id}/${row.technology_number}`,filterData.value).then((res) => {
|
if (res.code == 200) {
|
|
produceDetailList.value = (res.data.data)
|
printVisible.value=true
|
|
} else {
|
|
ElMessage.warning(res.msg)
|
|
}
|
})
|
break
|
}
|
|
}
|
}
|
|
//筛选条件,有外键需要先定义明细里面的数据
|
let filterData = ref({
|
|
orderGlassDetail: {
|
productionId: '',
|
},
|
orderDetail: {
|
orderId: '',
|
productId: '',
|
productName: '',
|
}
|
|
|
})
|
let filterDataPrint =ref( {})
|
let printSetupDate = {
|
id:'',
|
printType:'',
|
printTypeName:'',
|
printState:''
|
}
|
//定义页面总页数
|
let pageTotal = ref('')
|
//定义数据返回结果
|
let produceList = ref([])
|
//定义数据返回结果
|
let produceDetailList = ref([])
|
//定义当前页数
|
let pageNum = $ref(1)
|
let pageState = null
|
|
const {currentRoute} = useRouter()
|
const route = currentRoute.value
|
|
let orderId = route.query.orderId
|
|
// 第一次加载查询
|
request.post(`/processCard/selectPrint/${orderId}`, filterData.value).then((res) => {
|
|
if (res.code == 200) {
|
produceList = produceList.value.concat(deepClone(res.data.data))
|
xGrid.value.reloadData(produceList)
|
gridOptions.loading = false
|
} else {
|
ElMessage.warning(res.msg)
|
}
|
})
|
|
request.post(`/processCard/printSetup`, filterDataPrint.value).then((res) => {
|
if (res.code == 200) {
|
printSetupDate = deepClone(res.data.data)
|
} else {
|
ElMessage.warning(res.msg)
|
}
|
})
|
|
//表尾求和
|
const sumNum = (list, field) => {
|
let count = 0
|
list.forEach(item => {
|
count += Number(item[field])
|
})
|
return count.toFixed(2)
|
}
|
|
|
const hasDecimal = (value) => {
|
const regex = /\./; // 定义正则表达式,查找小数点
|
return regex.test(value); // 返回true/false
|
}
|
|
|
const gridOptions = reactive({
|
loading: true,
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe: true,//斑马纹
|
rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
|
id: 'demo_1',
|
showFooter: true,//显示脚
|
printConfig: {},
|
importConfig: {},
|
exportConfig: {},
|
scrollX: {enabled: true},
|
scrollY: {enabled: true, gt: 0},//开启虚拟滚动
|
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},
|
{title: '操作', width: 55, slots: { default: 'button_slot' },fixed:"left"},
|
{type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
|
{type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
|
{
|
field: 'order_id',
|
title: t('order.orderId'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'process_id',
|
title: t('processCard.processId'),
|
showOverflow: "ellipsis",
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'customer_name',
|
title: t('customer.customerName'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'project',
|
title: t('order.project'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{field: 'technology_number', title: t('processCard.technologyNumber'), showOverflow: "ellipsis"},
|
{field: 'glass_address', title: t('processCard.glassAddress'),},
|
{field: 'quantity', title: t('order.quantity'),},
|
{field: 'total_area', title: t('order.area'),},
|
{field: 'product_name', title: t('order.product'),},
|
{field: 'glass_child', title: t('reportingWorks.glassChild'),},
|
{field: 'founder', title: t('processCard.founder'),},
|
{field: 'splitFrame_time', title: t('processCard.splitFrameTime'),},
|
],//表头按钮
|
|
toolbarConfig: {
|
buttons: [
|
{code: 'print', name: t('processCard.print'), status: 'primary'},
|
{code: 'printLabel', name: t('processCard.printLabel'), status: 'primary'},
|
{code: 'printSetup', name: t('processCard.printSetup'),status: 'primary'},
|
|
],
|
// import: false,
|
// export: true,
|
//print: true,
|
zoom: true,
|
custom: true
|
},
|
data: null,//表格数据
|
//脚部求和
|
footerMethod ({ columns, data }) {//页脚函数
|
return[
|
columns.map((column, columnIndex) => {
|
if (columnIndex === 0) {
|
return t('basicData.total')
|
}
|
const List = ["quantity",'total_area',]
|
if (List.includes(column.field)) {
|
return footSum(data, column.field)
|
}
|
return ''
|
})
|
]
|
}
|
})
|
|
const gridEvents = {
|
toolbarButtonClick ({ code}) {
|
const $grid = xGrid.value
|
selectRecords = $grid.getCheckboxRecords()
|
if ($grid) {
|
switch (code) {
|
case 'print': {
|
if(selectRecords===null ||selectRecords===''||selectRecords.length===0){
|
ElMessage.warning(t('searchOrder.msgList.checkOrder'))
|
return
|
}
|
|
let id = ""
|
for (let i = 0; i < selectRecords.length; i++) {
|
if (i + 1 === selectRecords.length) {
|
id += selectRecords[i].id
|
} else {
|
id += selectRecords[i].id + "|"
|
}
|
}
|
router.push({path: '/main/processCard/printProcess', query: {printList: JSON.stringify(selectRecords)}})
|
|
break
|
}
|
|
case 'printLabel': {
|
if(selectRecords===null ||selectRecords===''||selectRecords.length===0){
|
ElMessage.warning(t('searchOrder.msgList.checkOrder'))
|
return
|
}
|
|
let id = ""
|
for (let i = 0; i < selectRecords.length; i++) {
|
if (i + 1 === selectRecords.length) {
|
id += selectRecords[i].id
|
} else {
|
id += selectRecords[i].id + "|"
|
}
|
}
|
router.push({path: '/main/processCard/PrintLabel', query: {printList: JSON.stringify(selectRecords)}})
|
|
break
|
}
|
case 'printSetup': {
|
dialogTableVisibleSetup.value=true
|
break
|
}
|
case 'sort': {
|
const $table = xGridDetail.value
|
let data = $table.getTableData().fullData
|
let flowCardData = ref({
|
flowCard: data,
|
})
|
request.post("/processCard/printSort", flowCardData.value).then((res) => {
|
if (res.code == 200) {
|
ElMessage.success("排序成功")
|
//router.push('/main/processCard/SplittingDetails?orderId=${orderId}')
|
router.push({
|
path: '/main/processCard/PrintFlowCard',
|
query: {orderId: orderId,random: Math.random()}
|
})
|
|
//location.reload();
|
} else {
|
ElMessage.warning(res.msg)
|
}
|
})
|
break
|
}
|
}
|
}
|
},
|
}
|
|
let checkbox= ref({
|
customerName:0,
|
orderId:0,
|
typeName:0,
|
specifications:0,
|
project:0,
|
remarks:0,
|
glassChild:0,
|
processingNote:0,
|
})
|
|
const changeDate = ()=>{
|
|
request.post(`/processCard/updatePrintSetup`, checkbox.value).then((res) => {
|
if (res.code == 200) {
|
dialogTableVisibleSetup.value=false
|
} else {
|
ElMessage.warning(res.msg)
|
}
|
})
|
|
|
const detailGridOptions = reactive({
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe: true,//斑马纹
|
rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
|
id: 'demo_1',
|
showFooter: true,//显示脚
|
printConfig: {},
|
importConfig: {},
|
exportConfig: {},
|
scrollX: {enabled: true},
|
scrollY: {enabled: true, gt: 0},//开启虚拟滚动
|
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: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
|
{
|
field: 'sort',
|
width: 80,
|
editRender: {name: 'input', attrs: {placeholder: ''}},
|
title: '排序',
|
},
|
{
|
field: 'process_id',
|
title: '流程卡号',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'order_number',
|
title: '序号',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'technology_number',
|
title: '小片顺序',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'glass_address',
|
title: '小片标记',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'quantity',
|
title: '数量',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'child_width',
|
title: '宽',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'child_height',
|
title: '高',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
{
|
field: 'area',
|
title: '面积',
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged
|
},
|
],//表头按钮
|
|
toolbarConfig: {
|
buttons: [
|
{code: 'sort', name: '排序', status: 'primary'},
|
],
|
// import: false,
|
// export: true,
|
//print: true,
|
zoom: true,
|
custom: true
|
},
|
data: null,//表格数据
|
//脚部求和
|
footerMethod ({ columns, data }) {//页脚函数
|
return[
|
columns.map((column, columnIndex) => {
|
if (columnIndex === 0) {
|
return t('basicData.total')
|
}
|
const List = ["quantity",'area',]
|
if (List.includes(column.field)) {
|
return footSum(data, column.field)
|
}
|
return ''
|
})
|
]
|
}
|
})
|
|
const openedTable = () => {
|
let detail =ref(produceDetailList.value)
|
xGridDetail.value.reloadData(detail.value)
|
}
|
}
|
|
</script>
|
|
<template>
|
<div class="main-div-customer">
|
<vxe-grid
|
ref="xGrid"
|
class="mytable-scrollbar"
|
height="600px"
|
max-height="100%"
|
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)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span>
|
<span v-else>{{ row[item.field] }}</span>
|
|
</li>
|
</ul>
|
</template>
|
|
<!--左边固定显示的插槽-->
|
<!-- v-if="userStore.user.permissions.indexOf('SelectProductionBasicData.edit') > -1"-->
|
<template #button_slot="{ row }">
|
<el-button @click="getTableRow(row,'edit')"
|
link
|
type="primary"
|
size="small">
|
{{ $t('basicData.edit') }}
|
</el-button>
|
|
</template>
|
|
<template #num1_filter="{ column, $panel }">
|
<div>
|
<div v-for="(option, index) in column.filters" :key="index">
|
<input type="text"
|
v-model="option.data"
|
@input="changeFilterEvent($event, option, $panel)"/>
|
</div>
|
</div>
|
</template>
|
|
|
</vxe-grid>
|
<el-dialog
|
v-model="dialogTableVisible"
|
destroy-on-close
|
:title="$t('processCard.print')"
|
style="width: 80%;height:75% ">
|
<PrintProcess :printList="selectRecords"
|
style="width: 100%;height: 100%" />
|
</el-dialog>
|
|
<el-dialog
|
v-model="dialogTableVisibleLabel"
|
destroy-on-close
|
:title="$t('processCard.printLabel')"
|
style="width: 80%;height:75% ">
|
<PrintLabel :printList="selectRecords"
|
style="width: 100%;height: 100%" />
|
</el-dialog>
|
|
<el-dialog
|
@opened="openedTable"
|
v-model="printVisible"
|
title="流程卡明细"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
style="width: 80%;height:75% ">
|
<vxe-grid
|
ref="xGridDetail"
|
class="mytable-scrollbar"
|
max-height="100%"
|
height="600px"
|
size="small"
|
v-bind="detailGridOptions"
|
v-on="gridEvents">
|
|
<template #content="{ row }">
|
<ul class="expand-wrapper">
|
<li v-for="(item,index) in detailGridOptions.columns" v-show="item.field!=undefined ">
|
<span style="font-weight: bold">{{ item.title + ': ' }}</span>
|
<span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span>
|
<span v-else>{{ row[item.field] }}</span>
|
|
</li>
|
</ul>
|
</template>
|
|
<template #num1_filter="{ column, $panel }">
|
<div>
|
<div v-for="(option, index) in column.filters" :key="index">
|
<input type="text"
|
v-model="option.data"
|
@input="changeFilterEvent($event, option, $panel)"/>
|
</div>
|
</div>
|
</template>
|
|
</vxe-grid>
|
</el-dialog>
|
|
<el-dialog v-model="dialogTableVisibleSetup" :title="$t('processCard.printSetup')" style="width: 70%;height:75% ">
|
<div>
|
<el-button @click="changeDate" id="searchButton" type="primary" >{{ $t('basicData.save') }}</el-button>
|
</div>
|
|
|
<div class="order-primary" >
|
<el-checkbox v-model="checkbox.customerName" :checked="printSetupDate[0].printState===1">{{ $t('customer.customerName') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.project" :checked="printSetupDate[1].printState===1">{{ $t('order.project') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.orderId" :checked="printSetupDate[6].printState===1">{{ $t('order.orderId') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.specifications" :checked="printSetupDate[2].printState===1">{{ $t('processCard.specificationQuantity') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.remarks" :checked="printSetupDate[3].printState===1">{{ $t('order.floorNumber') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.processingNote" :checked="printSetupDate[4].printState===1">{{ $t('order.processingNote') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.glassChild" :checked="printSetupDate[5].printState===1">{{ $t('processCard.singlePieceProductName') }}</el-checkbox>
|
<el-checkbox v-model="checkbox.typeName" :checked="printSetupDate[7].printState===1">{{ $t('processCard.productType') }}</el-checkbox>
|
</div>
|
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<style scoped>
|
.main-div-customer {
|
width: 99%;
|
height: 100%;
|
}
|
|
</style>
|