<script setup>
|
|
import request from "@/utils/request"
|
import deepClone from "@/utils/deepClone"
|
import {ElCheckbox, ElDatePicker, ElMessage} from "element-plus"
|
import useProductGlassTypeStore from "@/stores/sd/product/productGlassType"
|
import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
|
import {ArrowLeftBold, Search} from "@element-plus/icons-vue"
|
import GlassType from "@/components/sd/product/GlassType.vue"
|
import {useRouter} from 'vue-router'
|
import Sortable from 'sortablejs'
|
import BasicTable from '@/components/sd/product/BasicTable.vue'
|
import {VXETable} from "vxe-table";
|
import useUserInfoStore from "@/stores/userInfo";
|
import {useI18n} from 'vue-i18n'
|
import footSum from "@/hook/footSum"
|
import {changeFilterEvent,filterChanged} from "@/hook"
|
import userInfo from "@/stores/userInfo"
|
//语言获取
|
const {t} = useI18n()
|
let productGlassTypeStore = useProductGlassTypeStore()
|
let router = useRouter()
|
const userStore = useUserInfoStore()
|
const username = userStore.user.userName
|
const user=userInfo()
|
let flag = $ref(true)
|
|
function intoCreateProduct() {
|
if (flag) {
|
router.push(`/main/processCard/SplittingDetails?orderId=${orderId}`)
|
} else {
|
router.push('/main/processCard/SplittingDetails?orderId=${orderId}')
|
}
|
flag = !flag
|
}
|
|
//倒叙
|
let flashback = ref(1)
|
|
//定义排序规则
|
const optionVal = ref(0)
|
const options = [
|
{
|
value: 0,
|
label: t('processCard.mainWidth'),
|
},
|
{
|
value: 1,
|
label: t('processCard.mainHeight'),
|
},
|
]
|
|
//定义时间
|
const form = reactive({
|
date1: '',
|
})
|
|
//表尾求和
|
const sumNum = (list, field) => {
|
let count = 0
|
list.forEach(item => {
|
count += Number(item[field])
|
})
|
return count.toFixed(2)
|
}
|
|
//定义滚动条高度
|
let scrollTop = ref(null)
|
let scrollHeight = ref(null)
|
let clientHeight = ref(null)
|
const scrollEvnt = (row) => {
|
// 内容高度
|
scrollTop.value = row.$event.target.scrollTop
|
scrollHeight.value = row.$event.target.scrollHeight
|
clientHeight.value = row.$event.target.clientHeight
|
}
|
//筛选条件,有外键需要先定义明细里面的数据
|
let filterData = ref({})
|
//定义页面总页数
|
let pageTotal = ref('')
|
//定义数据返回结果
|
let produceList = ref([])
|
//定义当前页数
|
let pageNum = $ref(1)
|
let pageState = null
|
|
const {currentRoute} = useRouter()
|
const route = currentRoute.value
|
|
const orderId = route.query.orderId
|
const productionId = route.query.productionId
|
const orderQuantity = route.query.quantity
|
|
const orderOtherMoney = ref(null)
|
|
let maxProcseeId=null
|
//第一次加载数据
|
|
request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => {
|
|
if (res.code == 200) {
|
pageTotal.value = res.data.total
|
maxProcseeId=res.data.maxFlowCard[0].process_id
|
orderOtherMoney.value = res.data.orderOtherMoney
|
orderOtherMoney.value.forEach(item => {
|
let column = {
|
field: `${item.column}`,
|
width: 100,
|
title: item.alias,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
sortable: true
|
}
|
|
gridOptions.columns.push(column)
|
|
})
|
produceList = produceList.value.concat(deepClone(res.data.data))
|
produceList.forEach(item => {
|
// 如果 shape 可能是字符串就用 ==,如果一定是数字就用 ===
|
item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape');
|
});
|
xGrid.value.reloadData(produceList)
|
gridOptions.loading = false
|
} else {
|
ElMessage.warning(res.msg)
|
}
|
})
|
|
|
|
function padLeftZero(str) {
|
return ('00' + str).substr(str.length)
|
}
|
|
|
/*后端返回结果多层嵌套展示*/
|
const hasDecimal = (value) => {
|
const regex = /\./; // 定义正则表达式,查找小数点
|
return regex.test(value); // 返回true/false
|
}
|
|
|
|
|
//右侧子组件接收参数
|
const xGrid = ref()
|
const gridOptions = reactive({
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe: true,//斑马纹
|
rowConfig: {isCurrent: true, isHover: true, height: 30, useKey: false},//鼠标移动或选择高亮
|
id: 'AddProcessCardRight',
|
showFooter: true,//显示脚
|
printConfig: {},
|
importConfig: {},
|
exportConfig: {},
|
scrollY: {enabled: true},//开启虚拟滚动
|
showOverflow: true,
|
columnConfig: {
|
resizable: true,
|
useKey: true
|
},
|
filterConfig: { //筛选配置项
|
//remote: true
|
},
|
formConfig: {
|
data: {
|
shelfThickness: 800,
|
spacerThickness: 0,
|
inWeight: 4000,
|
inMaxQuantity: 20,
|
inLenMin:350,
|
inLenMax:3500,
|
inShortMax:2500,
|
inShortMin:350
|
},
|
rules:{
|
shelfThickness: [
|
{ required: true, message: t('basicData.msg.greater0'),type:'number',pattern:/^[1-9]\d*$/ }
|
],
|
spacerThickness: [
|
{ required: true, message: t('delivery.pleaseEnterANumericalValueGreaterThanOrEqualTo0'),type:'number',pattern:/^[0-9]\d*$/ }
|
],
|
inWeight: [
|
{ required: true, message: t('basicData.msg.greater0'),type:'number',pattern:/^[1-9]\d*$/ }
|
],
|
inMaxQuantity: [
|
{ required: true, message: t('basicData.msg.greater0'),type:'number',pattern:/^[1-9]\d*$/ }
|
]
|
},
|
items:[
|
{ field: 'shelfThickness', title: t('processCard.depthShelf'), itemRender: { name: 'VxeInput' },span:8,folding: true},
|
{ field: 'inWeight', title:t('processCard.shelfCapacity'), itemRender: { name: 'VxeInput' },span:8,folding: true },
|
{ field: 'spacerThickness', title: t('processCard.IntervalThickness'), itemRender: { name: 'VxeInput' } ,span:8,folding: true},
|
{ field: 'inLenMax', title: t('processCard.LongestLargestMax'), itemRender: { name: 'VxeInput' },span:8,folding: true },
|
{ field: 'inLenMin', title: t('processCard.LongestShortestMax'), itemRender: { name: 'VxeInput' },span:8,folding: true },
|
{ field: 'inMaxQuantity', title: t('processCard.quantityMax'), itemRender: { name: 'VxeInput' } ,span:8,folding: true},
|
{ field: 'inShortMax', title: t('processCard.shortestLongest'), itemRender: { name: 'VxeInput' },span:8,folding: true },
|
{ field: 'inShortMin', title: t('processCard.shortestSide'), itemRender: { name: 'VxeInput' },span:8,folding: true },
|
{
|
span: 24,
|
collapseNode: true,
|
align: 'center',
|
itemRender: {
|
name: 'VxeButtonGroup',
|
options: [
|
{ type: 'submit', content: t('processCard.intelligentBranching'), status: 'primary' },
|
{ type: 'reset', content: t('processCard.reset') }
|
]
|
}
|
}
|
]
|
},
|
customConfig: {
|
storage: true
|
},
|
sortConfig: {
|
multiple: true,
|
chronological: true
|
},
|
editConfig: {
|
trigger: 'click',
|
mode: 'row',
|
showStatus: true
|
},//表头参数
|
columns: [
|
{type: 'checkbox', fixed: "left", title: t('basicData.check'), width: '80px'},
|
{
|
field: 'orderNumber',
|
title: t('order.OrderNum'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '100px'
|
},
|
{
|
field: 'shape',
|
title: t('order.shape'),
|
showOverflow: "ellipsis",
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '70px'
|
},
|
{
|
field: 'longSide',
|
title: t('processCard.longSide'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '90px'
|
},
|
{
|
field: 'shortSide',
|
title: t('processCard.shortSide'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '90px'
|
},
|
|
{
|
field: 'buildingNumber',
|
title: t('order.buildingNumber'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '120px'
|
},
|
{field: 'baiscQuantity', title: t('processCard.quantityToDivided'), showOverflow: "ellipsis", width: '80px'},
|
{
|
field: 'width',
|
title: t('order.width'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '78px'
|
},
|
{
|
field: 'height',
|
title: t('order.height'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '78px'
|
},
|
{field: 'computeGrossArea', title: t('processCard.areaToDivided'), width: '80px'},
|
{field: 'totalThickness', title: t('processCard.totalThickness'), width: '80px'},
|
{field: 'thickness', title: t('processCard.glassThickness'), width: '80px'},
|
{field: 'weight', title: t('processCard.weight'), slots: {default: 'weight_sum'}, width: '85px'},
|
{field: 'remarks', title: t('processCard.notes'), width: '85px',filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod: filterChanged},
|
{field: 'processing_note', title: t('order.processingNote'), width: '105px',filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod: filterChanged},
|
{field: 'bend_radius', title: t('order.bendRadius'), width: '120px',filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod: filterChanged,sortable: true,}
|
|
],//表头按钮
|
|
toolbarConfig: {
|
// import: false,
|
// export: true,
|
// print: true,
|
zoom: true,
|
custom: true
|
},
|
data: [],//table body实际数据
|
//脚部求和
|
|
footerMethod({columns, data}) {//页脚函数
|
let count = 0
|
return [
|
columns.map((column, columnIndex) => {
|
if (columnIndex === 0) {
|
return t('basicData.total')
|
}
|
|
const List = ["baiscQuantity", 'computeGrossArea']
|
if (List.includes(column.field)) {
|
return footSum(data, column.field)
|
}
|
if (column.field === 'weight') {
|
data.forEach(row => {
|
count += weightSum(row)
|
})
|
return parseFloat(count.toFixed(2))
|
}
|
return ''
|
})
|
]
|
},
|
|
})
|
const gridEventsRight = {
|
formSubmit () {
|
let form = gridOptions.formConfig.data
|
form.orderId =orderId
|
form.productionId = productionId
|
request.post(`/processCard/processCardAutoRack`,form).then(res => {
|
xGridLeft.value.reloadData(res.data.orderDetailList)
|
console.log(res.data.orderDetailList)
|
xGrid.value.reloadData(res.data.orderDetailsNotScope)
|
})
|
},
|
formReset () {
|
router.push({
|
path: '/main/processCard/AddProcessCard',
|
query: {orderId: orderId,
|
productionId: productionId,
|
quantity: orderQuantity,
|
random:Math.random()
|
}
|
})
|
}
|
}
|
|
//左侧子组件接收参数
|
const xGridLeft = ref()
|
const gridLeftOptions = reactive({
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe: true,//斑马纹
|
rowConfig: {isCurrent: true, isHover: true, height: 30, useKey: false},//鼠标移动或选择高亮
|
id: 'AddProcessCardLeft',
|
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: 'checkbox', fixed: "left", title: t('basicData.check'),width: 78},
|
{
|
field: 'processId',
|
title: t('processCard.processId'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
width: 135,
|
filterMethod: filterChanged,
|
},
|
{
|
field: 'orderNumber',
|
title: t('order.OrderNum'),
|
showOverflow: "ellipsis",
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'}
|
, filterMethod: filterChanged,
|
width: 98
|
},
|
{
|
field: 'landingSequence',
|
title: t('processCard.landingSequence'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: 99
|
},
|
{field: 'quantity', title: t('order.quantity'),width:70},
|
{
|
field: 'shape',
|
title: t('order.shape'),
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width:70
|
},
|
{
|
field: 'building_number',
|
title: t('order.buildingNumber'),
|
sortable: true,
|
filters: [{data: ''}],
|
slots: {filter: 'num1_filter'},
|
filterMethod: filterChanged,
|
width: '120px'
|
},
|
{field: 'width', title: t('order.width'), showOverflow: "ellipsis",width:70},
|
{field: 'height', title: t('order.height'),width:70},
|
|
{field: 'totalThickness', title: t('processCard.totalThickness'),width:70},
|
],//表头按钮
|
|
toolbarConfig: {
|
buttons: [
|
{code: 'saveFlowCard', name: t('basicData.save'), status: 'primary', icon: 'vxe-icon-save'},
|
],
|
// import: false,
|
// export: true,
|
// print: true,
|
zoom: true,
|
custom: true
|
},
|
data: [],//table body实际数据
|
//脚部求和
|
footerMethod({columns, data}) {//页脚函数
|
return [
|
columns.map((column, columnIndex) => {
|
if (columnIndex === 0) {
|
return t('basicData.total')
|
}
|
const List = ["quantity", 'goodsQuantity', 'area']
|
if (List.includes(column.field)) {
|
return footSum(data, column.field)
|
}
|
return ''
|
})
|
]
|
}
|
|
})
|
//定义输入数量
|
let checkedNum = ref('')
|
//创建流程卡
|
const createProcessCard = () => {
|
const $grid = xGrid.value
|
const checkedList = $grid.getCheckboxRecords()
|
|
if (checkedList.length === 0) {
|
ElMessage.warning(t('processCard.schedulingOk'))
|
return
|
}
|
|
const $gridLeft = xGridLeft.value
|
const leftData = $gridLeft.getTableData().fullData
|
|
// 获取最大落架顺序
|
let index = 1
|
if (leftData.length !== 0) {
|
index = Math.max(...leftData.map(d => d.landingSequence || 0)) + 1
|
}
|
|
// 生成 processId(最大尾号 + 1)
|
let maxProcIdNum = 0
|
if (leftData.length > 0) {
|
maxProcIdNum = Math.max(...leftData.map(item => {
|
const pid = item.processId
|
return parseInt(pid?.slice(-3)) || 0
|
}))
|
}
|
|
const baseIdNum = Math.max(
|
maxProcIdNum,
|
parseInt(maxProcseeId?.slice(-3) || '0')
|
) + 1
|
|
const processId = productionId + baseIdNum.toString().padStart(3, '0')
|
|
// 校验数量
|
const regex = /^(\d+|)$/
|
if (!regex.test(checkedNum.value)) {
|
ElMessage.warning(t('processCard.schedulingNo'))
|
return
|
}
|
|
try {
|
if (/^[1-9]\d*$/.test(checkedNum.value)) {
|
// 有输入数量的
|
checkedList.forEach((item) => {
|
if (item.baiscQuantity < checkedNum.value * 1) {
|
throw new Error(t('processCard.schedulingQuantity'))
|
}
|
|
const newItem = JSON.parse(JSON.stringify(item))
|
//更新key
|
newItem._X_ROW_KEY = `${processId}_${newItem.orderNumber}_${Date.now()}_${Math.random()}`
|
newItem.quantity = checkedNum.value * 1
|
newItem.processId = processId
|
newItem.landingSequence = index
|
newItem.baiscQuantity -= checkedNum.value * 1
|
newItem.computeGrossArea = (
|
newItem.computeGrossArea - newItem.width * newItem.height * checkedNum.value / 1000000
|
).toFixed(2)
|
|
if (item.baiscQuantity === newItem.quantity) {
|
$grid.remove(item)
|
} else {
|
item.baiscQuantity -= newItem.quantity // 保持右表剩余数量正确
|
item.computeGrossArea = (
|
item.computeGrossArea - item.width * item.height * newItem.quantity / 1000000
|
).toFixed(2)
|
}
|
|
const currentLeft = $gridLeft.getTableData().fullData
|
$gridLeft.clearSort()
|
$gridLeft.loadData([...currentLeft, newItem])
|
$grid.refreshColumn()
|
|
})
|
} else if (checkedNum.value === '') {
|
// 未输入数量
|
const currentLeft = $gridLeft.getTableData().fullData
|
const newList = checkedList.map(item => {
|
const newItem = JSON.parse(JSON.stringify(item))
|
newItem.quantity = newItem.baiscQuantity
|
newItem.processId = processId
|
newItem.landingSequence = index
|
return newItem
|
})
|
|
$grid.remove(checkedList)
|
$gridLeft.clearSort()
|
$gridLeft.loadData([...currentLeft, ...newList])
|
}
|
|
// 清空选择和输入
|
$gridLeft.clearCheckboxRow()
|
$grid.clearCheckboxRow()
|
checkedNum.value = ''
|
|
} catch (e) {
|
ElMessage.warning(e.message || t('processCard.msg.msg1'))
|
}
|
}
|
|
|
|
|
|
//按编号创建流程卡
|
const createProcessCardNo = () => {
|
const $grid = xGrid.value
|
const checkedList = $grid.getCheckboxRecords()
|
|
if (checkedList.length === 0) {
|
ElMessage.warning(t('processCard.schedulingOk'))
|
return
|
}
|
//productionId
|
const $gridLeft = xGridLeft.value
|
const leftData = $gridLeft.getTableData().fullData
|
let index = 0
|
if (leftData.length !== 0) {
|
index = leftData[0].landingSequence + 1
|
//index = index.toString().padStart(2, '0')
|
}
|
|
let processId= null
|
|
if (maxProcseeId!== null || maxProcseeId!== undefined|| maxProcseeId!== ''){
|
if (leftData.length !== 0){
|
const str=leftData[0].processId
|
const lastThree = str.slice(-3);
|
const result = lastThree*1 + 1;
|
processId= productionId + result.toString().padStart(3, '0')
|
}
|
else {
|
// 截取后三位
|
const lastThree = maxProcseeId.slice(-3);
|
const result = lastThree*1 + 1;
|
processId= productionId + result.toString().padStart(3, '0')
|
}
|
|
}
|
else {
|
|
processId = productionId + index.toString().padStart(3, '0')
|
|
|
}
|
|
|
const regex = /^(\d+|)$/;
|
if (!regex.test(checkedNum.value)) {
|
ElMessage.warning(t('processCard.schedulingNo'))
|
return
|
}
|
|
checkedList.forEach((item) => {
|
index++
|
processId = productionId + index.toString().padStart(3, '0')
|
item.processId = processId
|
item.landingSequence = index
|
item.quantity = item.baiscQuantity
|
})
|
//删除key
|
checkedList.forEach((item) => {
|
delete item._X_ROW_KEY
|
})
|
$gridLeft.insertAt(checkedList)
|
$grid.remove(checkedList)
|
//清除两边复选框
|
$gridLeft.clearCheckboxRow()
|
$grid.clearCheckboxRow()
|
|
}
|
|
//向右2
|
const addRight = () => {
|
try {
|
// 左边表格定义
|
const $gridLeft = xGridLeft.value
|
// 右边表格定义
|
const $grid = xGrid.value
|
// 获取左边表格checkbox选中的数据
|
const checkedList = $gridLeft.getCheckboxRecords()
|
|
// 判断左边表格是否有选中的数据
|
if (checkedList.length === 0) {
|
ElMessage.warning(t('processCard.schedulingArea'))
|
return
|
}
|
|
const regex = /^(\d+|)$/
|
if (!regex.test(checkedNum.value)) {
|
ElMessage.warning(t('processCard.schedulingNo'))
|
return
|
}
|
|
// 判断正整数
|
if (/^[1-9]\d*$/.test(checkedNum.value)) {
|
// 对选中的左边表格数据进行循环
|
checkedList.forEach((item) => {
|
// 判断可用数量是否大于等于输入的数量, 不满足则提示
|
if (item.quantity < checkedNum.value * 1) {
|
ElMessage.warning(t('processCard.schedulingQuantity'))
|
}
|
|
// 左边表格可用数量减去输入的数量
|
item.quantity = item.quantity - checkedNum.value
|
|
// 右边表格数据
|
const rightData = $grid.getTableData().fullData
|
// 右边表格数据中查找当前数据下标(以 orderNumber 匹配)
|
const filterIndex = rightData.findIndex(d => d.orderNumber === item.orderNumber)
|
|
if (filterIndex >= 0) {
|
// 数量叠加
|
rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + checkedNum.value * 1
|
// 面积重算
|
rightData[filterIndex].computeGrossArea = (
|
rightData[filterIndex].width * rightData[filterIndex].height * rightData[filterIndex].baiscQuantity / 1000000
|
).toFixed(2)
|
|
// 如果左边数量为0时删除此条数据
|
const key = item._X_ROW_KEY
|
delete item._X_ROW_KEY
|
if (item.baiscQuantity === 0 || item.quantity === 0) {
|
$gridLeft.remove(item)
|
}
|
item._X_ROW_KEY = key
|
} else {
|
// 右边表格没有此条数据则往右边表格插入数据
|
item.baiscQuantity = checkedNum.value
|
item.computeGrossArea = (item.width * item.height * checkedNum.value / 1000000).toFixed(2)
|
if (item.quantity === 0) {
|
$gridLeft.remove(item)
|
}
|
$grid.insert(item)
|
}
|
|
if (item.quantity === 0) {
|
$gridLeft.remove(item)
|
}
|
})
|
} else if (checkedNum.value === '') { // 数量输入框无输入数字:全量移动
|
checkedList.forEach((item) => {
|
// 右侧表格
|
const rightData = $grid.getTableData().fullData
|
const filterIndex = rightData.findIndex(d => d.orderNumber === item.orderNumber)
|
|
if (filterIndex > -1) {
|
rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + item.quantity * 1
|
rightData[filterIndex].computeGrossArea = (
|
rightData[filterIndex].width * rightData[filterIndex].height * rightData[filterIndex].baiscQuantity / 1000000
|
).toFixed(2)
|
} else {
|
item.baiscQuantity = item.quantity * 1
|
delete item._X_ROW_KEY
|
$grid.insert(item)
|
}
|
|
$gridLeft.remove(item)
|
})
|
}
|
|
// ===== 下面这部分:把“倒序”改成“顺序” =====
|
|
// 获取左表剩余数据
|
const leftDataList = $gridLeft.getTableData().fullData
|
const baseProcessId = productionId // 固定前缀
|
|
// 取ID末尾数字(没有数字则返回极大值,防止相减 NaN/错序)
|
const tailNum = (id) => {
|
const m = String(id ?? '').match(/(\d+)$/)
|
return m ? parseInt(m[1], 10) : Number.MAX_SAFE_INTEGER
|
}
|
|
// 先按原 processId 分组
|
const groupedByOld = leftDataList.reduce((acc, row) => {
|
const pid = row.processId
|
if (!acc[pid]) acc[pid] = []
|
acc[pid].push(row)
|
return acc
|
}, {})
|
|
// 拿到去重后的旧 processId 列表,并按“末尾数字”正序(小到大)排列
|
const oldIds = Object.keys(groupedByOld).sort((a, b) => {
|
const da = tailNum(a)
|
const db = tailNum(b)
|
if (da !== db) return da - db
|
// 尾数相同再按字典序兜底,确保稳定
|
return String(a).localeCompare(String(b))
|
})
|
|
// 构建从旧 processId -> 新 processId 的映射:001, 002, ... 正序递增
|
const pidMap = new Map()
|
oldIds.forEach((oldId, idx) => {
|
const newPid = `${baseProcessId}${String(idx + 1).padStart(3, '0')}`
|
pidMap.set(oldId, newPid)
|
})
|
|
|
oldIds.forEach((oldId, idx) => {
|
const group = groupedByOld[oldId]
|
const newPid = pidMap.get(oldId)
|
const seq = idx + 1
|
group.forEach((row) => {
|
row.processId = newPid
|
row.landingSequence = seq
|
})
|
})
|
|
// 清除两边复选框 & 刷新列
|
$gridLeft.clearCheckboxRow()
|
$grid.clearCheckboxRow()
|
$grid.refreshColumn()
|
} catch (e) {
|
ElMessage.warning(e.message)
|
}
|
|
// 每次点击清空输入框
|
if (checkedNum.value) {
|
checkedNum.value = ''
|
}
|
}
|
|
//向右边表格添加数据
|
// const addRight = () => {
|
// try {
|
// //左边表格定义
|
// const $gridLeft = xGridLeft.value
|
// //右边表格定义
|
// const $grid = xGrid.value
|
// //获取左边表格checkbox选中的数据
|
// const checkedList = $gridLeft.getCheckboxRecords()
|
// //判断左边表格是否有选中的数据
|
// if (checkedList.length === 0) {
|
// ElMessage.warning(t('processCard.schedulingArea'))
|
// return
|
// }
|
// const regex = /^(\d+|)$/;
|
// if (!regex.test(checkedNum.value)) {
|
// ElMessage.warning(t('processCard.schedulingNo'))
|
// return
|
// }
|
// //判断正整数
|
// if (/^[1-9]\d*$/.test(checkedNum.value)) {
|
// //对选中的左边表格数据进行循环
|
// checkedList.forEach((item) => {
|
// //判断可用数量是否大于等于输入的数量,不满足则抛出异常
|
// // if (item.quantity < checkedNum.value*1) throw new Error(t('processCard.schedulingQuantity'));
|
// if (item.quantity < checkedNum.value * 1) {
|
// ElMessage.warning(t('processCard.schedulingQuantity'))
|
// }
|
// //左边表格可用数量减去输入的数量
|
// item.quantity = item.quantity - checkedNum.value
|
// //右边表格数据
|
// let rightData = $grid.getTableData().fullData
|
// //右边表格数据中查找当前数据下标
|
// let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber)
|
// //如果右边表格数据中存在当前数据则数量相加
|
// if (filterIndex >= 0) {
|
// //数量
|
// rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + checkedNum.value * 1
|
// //面积
|
// rightData[filterIndex].computeGrossArea = (rightData[filterIndex].width * rightData[filterIndex].height * rightData[filterIndex].baiscQuantity / 1000000).toFixed(2)
|
// //如果左边数量为0时删除此条数据
|
// //删除key
|
// let key = item._X_ROW_KEY
|
// delete item._X_ROW_KEY
|
// if (item.baiscQuantity === 0) {
|
// $grid.remove(item)
|
// }
|
// item._X_ROW_KEY = key
|
// } else {
|
// //右边表格没有此条数据则往右边表格插入数据
|
// item.baiscQuantity = checkedNum.value
|
// item.computeGrossArea = (item.width * item.height * checkedNum.value / 1000000).toFixed(2)
|
// if (item.quantity === 0) {
|
// $gridLeft.remove(item)
|
// }
|
// $grid.insert(item)
|
// }
|
// if (item.quantity === 0) {
|
// $gridLeft.remove(item)
|
// }
|
// })
|
// } else if (checkedNum.value === '') {//判断数量输入框无输入数字
|
//
|
// checkedList.forEach((item) => {
|
// //右侧表格
|
// let rightData = $grid.getTableData().fullData
|
// let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber)
|
// //左侧表格
|
// let leftData = $gridLeft.getTableData().fullData
|
// let leftfilterIndex = leftData.findIndex(item1 => item1.orderNumber === item.orderNumber)
|
// //无输入并且如果右边表格数据中存在当前数据则数量相加
|
// if (filterIndex > -1) {
|
// rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + item.quantity * 1
|
// //面积
|
// rightData[filterIndex].computeGrossArea = (rightData[filterIndex].width * rightData[filterIndex].height * rightData[filterIndex].baiscQuantity / 1000000).toFixed(2)
|
//
|
// } else {
|
//
|
// item.baiscQuantity = item.quantity * 1
|
// delete item._X_ROW_KEY
|
// $grid.insert(item)
|
//
|
// }
|
//
|
// $gridLeft.remove(item)
|
// })
|
//
|
// }
|
//
|
// let leftDataList = $gridLeft.getTableData().fullData;
|
// let baseProcessId = productionId; // 固定的前缀
|
//
|
// // 统计所有不重复的 processId
|
// let uniqueProcessIds = new Set(leftDataList.map(item => item.processId));
|
// // 不重复的 processId 的总个数
|
// let totalUniqueCount = uniqueProcessIds.size;
|
// // 用于记录已经分配的 processId
|
// let usedProcessIds = new Set();
|
//
|
// leftDataList.forEach((item) => {
|
// let newProcessId;
|
// // 如果该 processId 是第一次出现,使用递减的编号生成新的 processId
|
// if (!usedProcessIds.has(item.processId)) {
|
// newProcessId = `${baseProcessId}${(totalUniqueCount).toString().padStart(3, '0')}`;
|
// usedProcessIds.add(item.processId); // 标记该 processId 已使用
|
// totalUniqueCount--; // 递减
|
//
|
// } else {
|
// // 如果该 processId 已经使用过,继续使用已分配的编号
|
// newProcessId = `${baseProcessId}${(totalUniqueCount + 1).toString().padStart(3, '0')}`;
|
//
|
// }
|
// // 更新 item.processId
|
// item.processId = newProcessId;
|
// });
|
// // 获取剩余数据,用于对落架顺序重新赋值
|
// let remainingData = $gridLeft.getTableData().fullData;
|
// // 按 processId 分组
|
// let groupedData = remainingData.reduce((acc, curr) => {
|
// if (!acc[curr.processId]) {
|
// acc[curr.processId] = [];
|
// }
|
// acc[curr.processId].push(curr);
|
// return acc;
|
// }, {});
|
//
|
// // 按 processId 排序(倒序)
|
// let sortedProcessIds = Object.keys(groupedData).sort((a, b) => b - a);
|
//
|
// // 更新每个分组的 landingSequence
|
// sortedProcessIds.forEach((processId, index) => {
|
// let group = groupedData[processId];
|
//
|
// // 对每个 processId 分组内的数据,不改变顺序,直接赋相同的 landingSequence
|
// group.forEach((item) => {
|
// item.landingSequence = sortedProcessIds.length - index; // 按倒序设置 landingSequence
|
// });
|
// });
|
// //清除两边复选框
|
// $gridLeft.clearCheckboxRow()
|
// $grid.clearCheckboxRow()
|
// $grid.refreshColumn()
|
// } catch (e) {
|
// ElMessage.warning(e.message)
|
// }
|
// //每次点击情况输入框
|
// if (checkedNum.value){
|
// checkedNum.value =''
|
// }
|
// }
|
|
|
//向左2
|
const addLeft = () => {
|
try {
|
const $gridLeft = xGridLeft.value
|
const $grid = xGrid.value
|
|
// 右表选中
|
const checkedList = $grid.getCheckboxRecords()
|
// 左表选中(要求只能选 1 条,用于确定目标流程卡)
|
const checkedListLeft = $gridLeft.getCheckboxRecords()
|
|
// 基本校验
|
if (!checkedList.length) {
|
ElMessage.warning(t('processCard.schedulingOk'))
|
return
|
}
|
if (checkedListLeft.length !== 1) {
|
ElMessage.warning(t('processCard.schedulingTime'))
|
return
|
}
|
const regex = /^(\d+|)$/
|
if (!regex.test(checkedNum.value)) {
|
ElMessage.warning(t('processCard.schedulingNo'))
|
return
|
}
|
|
const isValidNum = /^[1-9]\d*$/.test(checkedNum.value)
|
const targetProcId = checkedListLeft[0].processId
|
const targetLandingSeq = checkedListLeft[0].landingSequence
|
|
// 工具:把记录塞到左表表尾(存在相同 orderNumber+processId 就只合并数量)
|
const upsertToLeftTail = (srcRow, qtyToMove) => {
|
// 目标行应具有的键值
|
const keyOrder = srcRow.orderNumber
|
const keyProc = targetProcId
|
|
// 先找是否已有同 orderNumber + processId 的行
|
const leftFull = $gridLeft.getTableData().fullData
|
const existIdx = leftFull.findIndex(r => r.orderNumber === keyOrder && r.processId === keyProc)
|
|
if (existIdx >= 0) {
|
// 合并数量
|
leftFull[existIdx].quantity = (leftFull[existIdx].quantity || 0) * 1 + qtyToMove * 1
|
// 这里不额外扣 left 行的 computeGrossArea,避免重复扣减(扣减只在右侧减出时做)
|
// 如需左侧也扣,请按你的口径在此处补上
|
// 不需要 reload,这里直接改 fullData,最后统一 refresh
|
} else {
|
// 新建一条放到表尾
|
// 克隆一个干净对象,避免 _X_ROW_KEY 冲突
|
const { _X_ROW_KEY, ...plain } = srcRow
|
const newRow = {
|
...plain,
|
processId: targetProcId,
|
landingSequence: targetLandingSeq,
|
quantity: qtyToMove,
|
// 如果你希望新行也同步扣减自身面积,可以打开下面这一行;
|
// 否则注释保持只在右侧扣减一次
|
// computeGrossArea: (
|
// (plain.computeGrossArea || 0) - (plain.width * plain.height * qtyToMove) / 1000000
|
// ).toFixed(2)
|
}
|
$gridLeft.insertAt(newRow, -1) // 永远插到表尾
|
}
|
}
|
|
if (isValidNum) {
|
// 移动「指定数量」
|
const moveQty = checkedNum.value * 1
|
|
checkedList.forEach((item) => {
|
if ((item.baiscQuantity * 1) < moveQty) {
|
throw new Error(t('processCard.msg.msg2'))
|
}
|
|
// 右表扣数量、扣面积(只扣一次,避免左表再扣重复)
|
item.baiscQuantity = item.baiscQuantity * 1 - moveQty
|
item.computeGrossArea = (
|
(item.computeGrossArea * 1) - (item.width * item.height * moveQty) / 1000000
|
).toFixed(2)
|
|
// 写入左表(表尾),或合并
|
upsertToLeftTail(item, moveQty)
|
|
// 右表该行分完清零就删掉
|
if (item.baiscQuantity * 1 === 0) {
|
$grid.remove(item)
|
}
|
})
|
} else if (checkedNum.value === '') {
|
// 移动「全部待分数量」
|
checkedList.forEach((item) => {
|
const moveQtyAll = item.baiscQuantity * 1
|
if (moveQtyAll <= 0) return
|
|
// 右表扣到 0,扣面积
|
item.baiscQuantity = 0
|
item.computeGrossArea = (
|
(item.computeGrossArea * 1) - (item.width * item.height * moveQtyAll) / 1000000
|
).toFixed(2)
|
|
// 写入左表(表尾),或合并
|
upsertToLeftTail(item, moveQtyAll)
|
|
// 移除右表该行
|
$grid.remove(item)
|
})
|
}
|
|
// 清勾选 & 刷新
|
if ($gridLeft) $gridLeft.clearCheckboxRow()
|
if ($grid) $grid.clearCheckboxRow()
|
$grid.refreshColumn()
|
|
} catch (e) {
|
ElMessage.warning(e.message)
|
}
|
|
// 清空输入
|
if (checkedNum.value) {
|
checkedNum.value = ''
|
}
|
}
|
|
|
|
|
|
//向左边表格添加数据
|
// const addLeft = () => {
|
// try {
|
// //左边表格定义
|
// const $gridLeft = xGridLeft.value
|
// //右边表格定义
|
// const $grid = xGrid.value
|
// //获取右边表格checkbox选中的数据
|
// const checkedList = $grid.getCheckboxRecords()
|
// //获取左边表格checkbox选中的数据
|
// const checkedListLeft = $gridLeft.getCheckboxRecords()
|
// //判断右边表格是否有选中的数据
|
// if (checkedList.length * 1 === 0) {
|
// ElMessage.warning(t('processCard.schedulingOk'))
|
// return
|
// }
|
// if (checkedListLeft.length !== 1) {
|
// ElMessage.warning(t('processCard.schedulingTime'))
|
// return
|
// }
|
// const regex = /^(\d+|)$/;
|
// if (!regex.test(checkedNum.value)) {
|
// ElMessage.warning(t('processCard.schedulingNo'))
|
// return
|
// }
|
// //判断正整数
|
// if (/^[1-9]\d*$/.test(checkedNum.value)) {
|
// checkedList.forEach((item) => {
|
// //判断可用数量是否大于等于输入的数量,不满足则抛出异常
|
// if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error("请输入小于等于待分数量的数字");
|
// item.baiscQuantity = item.baiscQuantity - checkedNum.value
|
// item.computeGrossArea = (item.computeGrossArea - item.width * item.height * checkedNum.value / 1000000).toFixed(2)
|
// //定义key值保持
|
// let key = item._X_ROW_KEY
|
// //左边表格数据
|
// let leftData = $gridLeft.getTableData().fullData
|
// //左边表格数据中查找当前数据下标
|
// let filterIndex = leftData.findIndex(item1 => item1.orderNumber === item.orderNumber)
|
// //判断右侧勾选值与左侧是否相同
|
// if (checkedListLeft[0].orderNumber === item.orderNumber) {
|
//
|
// //如果右边表格数据中存在当前数据则数量相加
|
// if (filterIndex >= 0) {
|
// leftData[filterIndex].quantity = leftData[filterIndex].quantity * 1 + checkedNum.value * 1
|
// leftData[filterIndex].computeGrossArea = (leftData[filterIndex].computeGrossArea - leftData[filterIndex].width * leftData[filterIndex].height * leftData[filterIndex].baiscQuantity / 1000000).toFixed(2)
|
//
|
// if (item.baiscQuantity === 0) {
|
// $grid.remove(item)
|
// }
|
// $gridLeft.reloadData([...$gridLeft.getTableData().fullData])
|
// //delete item._X_ROW_KEY
|
// } else {
|
// item.quantity = checkedNum.value
|
// item.processId = checkedListLeft[0].processId
|
// item.landingSequence = checkedListLeft[0].landingSequence
|
// item.computeGrossArea = (item.computeGrossArea - checkedListLeft[0].width * checkedListLeft[0].height * checkedNum.value / 1000000).toFixed(2)
|
// delete item._X_ROW_KEY
|
// $gridLeft.insert(item)
|
// item._X_ROW_KEY = key
|
// }
|
// } else {
|
//
|
// //如果勾选两个值不同则插入同流程卡
|
// item.quantity = checkedNum.value
|
// item.processId = checkedListLeft[0].processId
|
// item.landingSequence = checkedListLeft[0].landingSequence
|
// // /item.computeGrossArea=item.computeGrossArea
|
// if (item.baiscQuantity === 0) {
|
// $grid.remove(item)
|
//
|
// }
|
// for (let i = 0; i < leftData.length; i++) {
|
// if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId === item.processId) {
|
// leftData[i].quantity = leftData[i].quantity * 1 + checkedNum.value * 1
|
// leftData[i].computeGrossArea = (leftData[i].computeGrossArea - leftData[i].width * leftData[i].height * leftData[i].baiscQuantity / 1000000).toFixed(2)
|
// break
|
// } else if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId !== item.processId) {
|
// delete item._X_ROW_KEY
|
// $gridLeft.insert(item)
|
// item._X_ROW_KEY = key
|
// break
|
// } else if (leftData[i].orderNumber !== item.orderNumber && leftData[i].processId !== item.processId) {
|
// delete item._X_ROW_KEY
|
// $gridLeft.insert(item)
|
// item._X_ROW_KEY = key
|
// break
|
// } else if (leftData[i].orderNumber !== item.orderNumber && leftData[i].processId == item.processId) {
|
// delete item._X_ROW_KEY
|
// $gridLeft.insert(item)
|
// item._X_ROW_KEY = key
|
// break
|
// }
|
//
|
// }
|
// }
|
//
|
// })
|
// } else if (checkedNum.value === '') {//判断数量输入框无输入数字
|
// checkedList.forEach((item) => {
|
// item.processId = checkedListLeft[0].processId
|
// item.landingSequence = checkedListLeft[0].landingSequence
|
// item.quantity = item.baiscQuantity
|
// item.computeGrossArea = (item.computeGrossArea - checkedListLeft[0].width * checkedListLeft[0].height * checkedListLeft[0].baiscQuantity / 1000000).toFixed(2)
|
// delete item._X_ROW_KEY
|
// })
|
// $gridLeft.insertAt(checkedList)
|
// $grid.remove(checkedList)
|
// }
|
// //清除两边复选框
|
// if ($gridLeft || $grid) {
|
// $gridLeft.clearCheckboxRow()
|
// $grid.clearCheckboxRow()
|
// }
|
// $grid.refreshColumn()
|
// } catch (e) {
|
// ElMessage.warning(e.message)
|
// }
|
// if (checkedNum.value){
|
// checkedNum.value =''
|
// }
|
// }
|
|
|
//保存流程卡数据
|
const gridEvents = {
|
toolbarButtonClick({code}) {
|
const $grid = xGridLeft.value
|
if ($grid) {
|
switch (code) {
|
case 'saveFlowCard': {
|
|
gridLeftOptions.toolbarConfig.buttons[0].disabled=true
|
const $table = xGridLeft.value
|
const $tableRight = xGrid.value
|
if ($table) {
|
const selectRecords = $table.getCheckboxRecords()
|
let leftData = $tableRight.getTableData().fullData
|
|
let data = $table.getTableData().fullData
|
if (leftData.length > 0) {
|
ElMessage.warning(t('processCard.pleaseFirstCreateAProcessCardForAllTheDataOnTheRightSideAndSaveIt'))
|
gridLeftOptions.toolbarConfig.buttons[0].disabled=false
|
return;
|
}
|
|
// 计算 $table 里 quantity 字段的总和
|
let totalQuantity = data.reduce((sum, record) => sum + (Number(record.quantity) || 0), 0);
|
// 对比全局变量 orderQuantity
|
if (totalQuantity !== orderQuantity*1) {
|
ElMessage.warning(`${t('processCard.msg.msg3')} (${totalQuantity}) ${t('processCard.msg.msg4')} (${orderQuantity}) ${t('processCard.msg.msg5')}`);
|
gridLeftOptions.toolbarConfig.buttons[0].disabled = false;
|
return;
|
}
|
gridOptions.loading=true
|
gridLeftOptions.loading=true
|
let flowCardData = ref({
|
flowCard: data,
|
userName: username,
|
productionId: productionId,
|
userId:user.user.userId
|
})
|
|
request.post(`/processCard/addFlowCard/${orderId}`, flowCardData.value).then((res) => {
|
if (res.code == 200) {
|
ElMessage.success(t('basicData.msg.saveSuccess'))
|
router.push({
|
path: '/main/processCard/AddProcessCard',
|
query: {orderId: orderId, productionId: productionId, random: Math.random()}
|
})
|
gridOptions.loading=false
|
gridLeftOptions.loading=false
|
} else {
|
gridOptions.loading=false
|
gridLeftOptions.loading=false
|
ElMessage.warning(res.msg)
|
}
|
})
|
|
}
|
return;
|
|
}
|
|
}
|
}
|
},
|
|
}
|
const weightSum = (row) => {
|
return parseFloat((row.baiscQuantity * row.thickness * row.width * row.height * 2.5 / 1000000).toFixed(2))
|
}
|
|
let quantit = ref('')
|
let weight = ref('')
|
const handleCheckboxChange = ({ row }) => {
|
const $grid = xGrid.value;
|
// 获取右边表格 checkbox 选中的数据
|
const checkedList = $grid.getCheckboxRecords();
|
let quantitySum = 0;
|
let weightsum = 0;
|
|
checkedList.forEach(item => {
|
quantitySum += Number(item.baiscQuantity) || 0; // 确保转换为数字
|
weightsum += weightSum(item);
|
});
|
|
quantit.value = Number(quantitySum) || 0; // 确保最终值是数字
|
weight.value = parseFloat(weightsum.toFixed(2));
|
};
|
|
//倒序赋值
|
function onFlashbackChange(checked) {
|
flashback.value = checked ? 0 : 1
|
}
|
</script>
|
|
<template>
|
<div style="width: 75%;height: 90%">
|
<div class="common-layout">
|
<el-button
|
id="searchButton1"
|
:icon="ArrowLeftBold"
|
round
|
style="float: left"
|
type="primary"
|
@click="intoCreateProduct">
|
{{ flag ? t('processCard.return') : t('processCard.return') }}
|
</el-button>
|
<!-- <el-button type="primary">保存分架</el-button>-->
|
<!-- <el-button type="primary" :hidden="true">分架汇总</el-button>-->
|
|
<el-container style="height: 100%;width: 100%">
|
<el-aside style="width: 52%;height: 100%">
|
<vxe-grid
|
ref="xGridLeft"
|
checkbox-config="{ reserve: true, strict: true }"
|
class="mytable-scrollbar"
|
height="100%"
|
v-bind="gridLeftOptions"
|
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>
|
<template #num1_filter="{ column, $panel }">
|
<div>
|
<div v-for="(option, index) in column.filters" :key="index">
|
<input v-model="option.data"
|
type="text"
|
@keyup.enter.native="$panel.confirmFilter()"
|
@input="changeFilterEvent($event, option, $panel)"/>
|
</div>
|
</div>
|
</template>
|
</vxe-grid>
|
|
</el-aside>
|
|
<div height="100%" style="margin: 5px" width="11%">
|
<el-main style="">
|
<div>
|
<span><el-input :readonly="true" v-model="quantit" style="width: 80px;"/></span>
|
<span><el-input :readonly="true" v-model="weight" style="width: 80px;"/></span>
|
</div>
|
<span>{{ $t('processCard.selectedQuantity') }}:<el-input id="checkedNum" v-model="checkedNum" clearable
|
type="number"></el-input></span><br>
|
<el-button style="width: 40px;" type="primary" @click="addRight"> →</el-button>
|
<br>
|
<br>
|
<el-button style="width: 40px;" type="primary" @click="addLeft"> ←</el-button>
|
<br>
|
<br>
|
<el-button type="primary" @click="createProcessCard">{{ $t('processCard.establishProcessCards') }}
|
</el-button>
|
<br><br><br><br><br>
|
<el-button type="primary" @click="createProcessCardNo">{{ $t('processCard.createBySequenceNumber') }}
|
</el-button>
|
</el-main>
|
</div>
|
|
|
<!-- 右侧-->
|
<div style="height: 100%;width: 70%">
|
|
<el-aside style="width: 100%;height: 100%">
|
<vxe-grid
|
id="rightTable"
|
ref="xGrid"
|
:checkbox-config="{labelField: 'name', highlight: true, range: true,reserve: true, strict: true}"
|
class="mytable-scrollbar"
|
height="100%"
|
v-bind="gridOptions"
|
v-on="gridEventsRight"
|
@checkbox-change="handleCheckboxChange"
|
@checkbox-all="handleCheckboxChange"
|
@checkbox-range-end="handleCheckboxChange"
|
>
|
|
<!-- @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>
|
<template #weight_sum="{ row }">
|
<span>{{ weightSum(row) }} </span>
|
</template>
|
|
<template #num1_filter="{ column, $panel }">
|
<div>
|
<div v-for="(option, index) in column.filters" :key="index">
|
<input v-model="option.data"
|
type="text"
|
@keyup.enter.native="$panel.confirmFilter()"
|
@input="changeFilterEvent($event, option, $panel)"/>
|
</div>
|
</div>
|
</template>
|
</vxe-grid>
|
</el-aside>
|
</div>
|
</el-container>
|
</div>
|
</div>
|
</template>
|
|
<style scoped>
|
* {
|
margin: 0;
|
padding: 0;
|
}
|
|
.common-layout {
|
width: 99%;
|
height: 96%;
|
}
|
|
.header {
|
width: 100%;
|
height: 35px;
|
margin-top: -20px;
|
}
|
|
.el-aside {
|
height: 100%;
|
}
|
|
.el-main {
|
height: 100%;
|
text-align: center;
|
}
|
|
|
|
</style>
|