<script setup>
|
import {defineEmits, onMounted, reactive, ref, watch} from "vue";
|
import {changeFilterEvent, filterChanged} from "@/hook"
|
import {useI18n} from "vue-i18n"
|
import request from "@/utils/request"
|
import {ElMessage} from "element-plus";
|
const { t } = useI18n()
|
const xGrid = ref()
|
const gridOptions = reactive({
|
loading:false,
|
border: "full",//表格加边框
|
keepSource: true,//保持源数据
|
align: 'center',//文字居中
|
stripe:true,//斑马纹
|
showOverflow:true,
|
id:'sizeCheck',
|
toolbarConfig: {
|
buttons: [
|
{'code': 'review', 'name': '审核',status: 'primary'},
|
]
|
},
|
|
rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
|
virtualScroll: true, // 开启虚拟滚动功能
|
scrollY:{ enabled: true,gt:13 },//开启虚拟滚动
|
//scrollX:{ enabled: true,gt:15 },//开启虚拟滚动
|
|
columnConfig: {
|
useKey: true
|
},
|
editConfig: {
|
trigger: 'dblclick',
|
mode: 'cell',
|
showStatus: true,
|
showIcon:false
|
},
|
mouseConfig:{selected: true},
|
keyboardConfig:{
|
isArrow: true,
|
isDel: true,
|
isEnter: true,
|
isTab: true,
|
isEdit: true,
|
isChecked: true,
|
enterToTab:true
|
},
|
|
customConfig: {
|
storage: true
|
},
|
columns:[
|
{field: 'width', title: '宽',editRender: { name: 'input'}},
|
{field: 'height', title:'高', editRender: { name: 'input'}},
|
{field: 'quantity', title: '数量' ,editRender: { name: 'input'}, },
|
],
|
editRules: {
|
width: [
|
{ required: true, message: '必填,参数不一致' }
|
],
|
height: [
|
{ required: true, message: '必填,参数不一致' }
|
],
|
quantity: [
|
{ required: true, message: '必填,参数不一致' }
|
]
|
}
|
})
|
|
const gridEvents = {
|
async toolbarButtonClick({code}) {
|
const $grid = xGrid.value
|
if ($grid) {
|
switch (code) {
|
case 'review' :{
|
const errMap = await $grid.validate(true)
|
if (errMap) {
|
ElMessage.error(t('basicData.msg.checkoutLose'))
|
return
|
}
|
// const $table = props.OrderDetail
|
// $table.getTableData().fullData.forEach((row)=>{
|
// if()row.computeGrossArea
|
// })
|
|
|
emit('getParent')
|
break
|
}
|
}
|
}
|
}
|
}
|
|
|
const emit = defineEmits(['getParent'])
|
|
let props = defineProps({
|
OrderDetail:null
|
})
|
onMounted(()=>{
|
const length = props.OrderDetail.getTableData().fullData.length
|
const $grid = xGrid.value
|
let list = []
|
for (let i = 0; i < length; i++) {
|
list.push({})
|
}
|
xGrid.value.reloadData(list)
|
|
})
|
|
const editClosedEvent = ({ row, column,rowIndex}) => {
|
const $table = props.OrderDetail
|
let checkVal = row[column.property]*1
|
const oldVal = $table.getTableData().fullData[rowIndex][column.property]*1
|
if(checkVal!=oldVal){
|
row[column.property]=null
|
}
|
}
|
|
</script>
|
|
<template>
|
<div style="width: 100%;height: 100%">
|
<vxe-grid
|
height="100%"
|
class="mytable-scrollbar"
|
ref="xGrid"
|
v-bind="gridOptions"
|
v-on="gridEvents"
|
@edit-closed="editClosedEvent"
|
>
|
</vxe-grid>
|
</div>
|
</template>
|
|
<style scoped>
|
|
</style>
|