| New file |
| | |
| | | <script setup> |
| | | import {defineEmits, onMounted, reactive, ref, watch} from "vue" |
| | | import {useI18n} from "vue-i18n" |
| | | import {ElMessage} from "element-plus" |
| | | import useOrderInfoStore from "@/stores/sd/order/orderInfo" |
| | | const { t } = useI18n() |
| | | const xGrid = ref() |
| | | const orderInfo = useOrderInfoStore() |
| | | const gridOptions = reactive({ |
| | | loading:false, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | showOverflow:true, |
| | | id:'sizeCheck', |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {'code': 'review', 'name': t('basicData.review'),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:[ |
| | | {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 }, |
| | | {field: 'width', title: t('order.width'),editRender: { name: 'input'}}, |
| | | {field: 'height', title:t('order.height'), editRender: { name: 'input'}}, |
| | | {field: 'quantity', title: t('order.quantity') ,editRender: { name: 'input'}, }, |
| | | ], |
| | | editRules: { |
| | | width: [ |
| | | { required: true, message: t('components.inconsistentParameters') } |
| | | ], |
| | | height: [ |
| | | { required: true, message:t('components.inconsistentParameters') } |
| | | ], |
| | | quantity: [ |
| | | { required: true, message:t('components.inconsistentParameters') } |
| | | ] |
| | | } |
| | | }) |
| | | |
| | | 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 |
| | | } |
| | | emit('getParent') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | const emit = defineEmits(['getParent']) |
| | | |
| | | let props = defineProps({ |
| | | OrderDetail:null, |
| | | orderId:null |
| | | }) |
| | | |
| | | |
| | | onMounted(()=>{ |
| | | const length = props.OrderDetail.getTableData().fullData.length |
| | | const $grid = xGrid.value |
| | | if(props.orderId !== orderInfo.orderId){ |
| | | orderInfo.clearOrderInfo() |
| | | orderInfo.orderId=props.orderId |
| | | |
| | | for (let i = 0; i < length; i++) { |
| | | orderInfo.reviewList.push({}) |
| | | } |
| | | } |
| | | |
| | | xGrid.value.reloadData(orderInfo.reviewList) |
| | | |
| | | }) |
| | | |
| | | 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> |