| New file |
| | |
| | | <script lang="ts" setup> |
| | | import {nextTick, onMounted, reactive, ref, watch} from "vue" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | import * as XLXS from "xlsx" |
| | | import {Action, ElMessage, ElMessageBox} from "element-plus" |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | import SelectProduct from "@/views/sd/product/SelectProduct.vue" |
| | | import CreateProduct from "@/views/sd/product/CreateProduct.vue" |
| | | import CreateCustomer from "@/views/sd/customer/CreateCustomer.vue" |
| | | import OrderOtherMoney from "@/components/sd/order/OrderOtherMoney.vue" |
| | | import OrderSizeCheck from "@/components/sd/order/OrderSizeCheck.vue" |
| | | import UpdateAlienEditor from "@/components/sd/order/UpdateAlienEditor.vue" |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove" |
| | | import downLoadFile from "@/hook/downLoadFile" |
| | | import footSum from "@/hook/footSum" |
| | | import {useI18n} from "vue-i18n" |
| | | import {multiply,multiplyAuto,divideAuto} from '@/utils/decimal' |
| | | import OrderNumberReportTransfer from "@/components/sd/order/OrderNumberReportTransfer.vue" |
| | | import UploadPicture from "@/components/sd/order/UploadPicture.vue" |
| | | const { t } = useI18n() |
| | | |
| | | let dialogTableVisible = ref(false) |
| | | let productVisible = ref(false) |
| | | let errorAreaVisible = ref(false) |
| | | let otherMoneyVisible = ref(false) |
| | | let sizeCheckVisible = ref(false) |
| | | let dialogTransferVisible = ref(false) |
| | | let uploadPictureVisible = ref(false) |
| | | let alienEditorVisible = ref(false) |
| | | const currentRow = ref(null) |
| | | const transferData = ref({ |
| | | oldOrderId:null, |
| | | newOrderNumber:null, |
| | | newOrderId:null, |
| | | oldOrderNumber:null, |
| | | }) |
| | | let orderIdVisible = ref(false) |
| | | const maxTableLen =ref(500) |
| | | const userStore = useUserInfoStore() |
| | | const company = companyInfo() |
| | | let errorArea = ref(company.errorArea) |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const xGrid = ref() |
| | | let cellArea = ref() |
| | | const shapeList = ref([ |
| | | {label:t('order.universalShape'),value:'1'}, {label:t('order.alien'),value:'2'} |
| | | ]) |
| | | const newOrderId = ref([]) |
| | | |
| | | // 定义表头上传数据 |
| | | const titleUploadData = ref({ |
| | | project:'', |
| | | orderType:'', |
| | | customerId:'', |
| | | customerName:'', |
| | | icon:'', |
| | | orderClassify:'', |
| | | packType:'', |
| | | orderId:'', |
| | | deliveryDate:'', |
| | | batch:'', |
| | | calculateType:null, |
| | | salesmanId:'', |
| | | salesman:'', |
| | | alType:'', |
| | | money:'', |
| | | contractId:'', |
| | | customerBatch:'', |
| | | contacts:'', |
| | | contactNumber:'', |
| | | deliveryAddress:'', |
| | | otherMoney:'', |
| | | otherMoneyRemarks:'', |
| | | processingNote:t('order.processingNote')+':', |
| | | createOrder:0, |
| | | creatorId:userStore.user.userId, |
| | | creator:userStore.user.userName, |
| | | }) |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | | orderOtherMoney:[], |
| | | orderType:[], |
| | | alType:[], |
| | | icon:[], |
| | | orderClassify:[], |
| | | packType:[], |
| | | customer:[], |
| | | saleMan:[] |
| | | }) |
| | | let filterData = ref({}) |
| | | let rowIndex = ref(null) |
| | | let rowClickIndex = ref(null) |
| | | let otherMoney = ref(null) |
| | | |
| | | const gridOptions = reactive({ |
| | | loading:false, |
| | | showHeaderOverflow: false, |
| | | showFooterOverflow: false, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | //virtualScroll: true, // 开启虚拟滚动功能 |
| | | id: 'CreateOrder', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | virtualXConfig:{ enabled: true,gt:0 },//开启虚拟滚动 |
| | | virtualYConfig:{ enabled: true,gt:0 },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'addRow', name: t('basicData.add'), prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false }, |
| | | { code: 'deleteRow', name: t('basicData.delete'), prefixIcon: 'vxe-icon-delete', visible: true, disabled: false }, |
| | | { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false }, |
| | | { code: 'clearChecked', name: t('basicData.clearSelection'), prefixIcon: 'vxe-icon-indicator', visible: true, disabled: false }, |
| | | { code: 'computedMoney', name: t('basicData.calculateAmount'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: true }, |
| | | { code: 'incrementalAll', name: t('basicData.incrementalAll'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false }, |
| | | { code: 'incrementalChecked', name: t('basicData.incrementalChecked'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | { code: 'errorArea', name: t('basicData.errorSettlementArea'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false }, |
| | | { code: 'otherMoney', name: t('basicData.otherAmounts'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false }, |
| | | { code: 'sizeCheck', name: t('basicData.sizeReview'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false }, |
| | | { code: 'updateOrderId', name: t('searchOrder.updateOrderId'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false }, |
| | | { code: 'reportingTransfer', name: t('searchOrder.reportingTransfer'), prefixIcon: 'vxe-icon-send', visible: true, disabled: true }, |
| | | { code: 'uploadPicture', name: t('order.graphic'),prefixIcon: 'vxe-icon-send', visible: true, } |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | //remote: true //远端筛选 |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | mouseConfig:{selected: true},//鼠标选中 |
| | | keyboardConfig:{ |
| | | isArrow: true, |
| | | isDel: true, |
| | | //isEnter: true, |
| | | isTab: true, |
| | | isEdit: true, |
| | | isChecked: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'dblclick', |
| | | mode: 'cell', |
| | | showStatus: true, |
| | | showIcon:false, |
| | | },//表头参数 |
| | | columns:[ |
| | | {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 }, |
| | | {field: 'productId',width:140, title: t('order.productId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'productName',width:300, title: t('order.product'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'buildingNumber',width:120, title: t('order.buildingNumber'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'price',width:140, title: t('order.price'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'grossAmount',width:160, title: t('order.grossAmount'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'width',width:120, title: t('order.width') ,editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'height',width:140, title: t('order.height'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'quantity',width:140, title: t('order.quantity'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'area',width:150, title: t('order.trueArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'grossArea',width:160, title: t('order.trueGrossArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'computeArea',width:180, title: t('order.computeArea'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'computeGrossArea',width:200, title: t('order.computeGrossArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'monolithicPerimeter',width:200, title: t('order.perimeter'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'shape',width:120, |
| | | title: t('order.shape'), |
| | | editRender: { name: 'input'}, |
| | | filters:[{ data: '' }], |
| | | slots: { filter: 'num1_filter',edit:'shape_edit',default:'default_shape' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'bendRadius',width:160, title: t('order.bendRadius'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'edgingType',width:160, title: t('order.edgingType'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'processingNote',width:200, title: t('order.processingNote'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'fileName',width:200, title: t('order.drawingNo'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'remarks',width:140, title: t('basicData.remarks'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | |
| | | |
| | | ], |
| | | //表单验证 |
| | | editRules: { |
| | | edgingType: [ |
| | | { required: company.edgingType}, |
| | | { min: 0, max: 10, message: t('basicData.msg.max10') } |
| | | ], |
| | | buildingNumber: [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ], |
| | | productId: [ |
| | | { required: true, message: t('order.msg.productCheck') } |
| | | ], |
| | | productName: [ |
| | | { required: true, message: t('order.msg.productCheck') } |
| | | ], |
| | | price: [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | | if ( !regex.test(cellValue) ) { |
| | | return new Error(t('basicData.msg.range99999Dec2') ) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | quantity: [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^[1-9]\d*$/ |
| | | if ( !regex.test(cellValue) ) { |
| | | return new Error(t('basicData.msg.greater0') ) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | computeArea: [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const decValue = company.decValue*1 |
| | | const regex =new RegExp(`^(0(\\.\\d{1,${decValue}})?|([1-9]\\d{0,4})(\\.\\d{1,${decValue}})?|99999(\\.9{1,${decValue}})?)$`) |
| | | if (!regex.test(cellValue)) { |
| | | return new Error(t(`basicData.msg.range99999Dec${decValue}`)) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | bendRadius:[ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,5})(\.\d{1,2})?|999999(\.9{1,2})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range999999Dec2')) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | width:[ |
| | | { |
| | | validator ({ cellValue }) { |
| | | //const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | | const regex = company.widHeiLength.regexp |
| | | if (!regex.test(cellValue)) { |
| | | return new Error(t(company.widHeiLength.msg)) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | height:[ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = company.widHeiLength.regexp |
| | | if ( !regex.test(cellValue)) { |
| | | return new Error(t(t(company.widHeiLength.msg))) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | }, |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {'code': 'remarks', 'name': t('order.processingNote')}, |
| | | {'code': 'Craft', 'name': t('order.technology'),status: 'primary',disabled: true}, |
| | | {'code': 'review', 'name': t('basicData.review'),status: 'primary',disabled: true}, |
| | | {'code': 'updateMoney', 'name': t('order.amountReset'),status: 'primary',disabled: true}, |
| | | {'code': 'saveOrder', 'name': t('basicData.save'),status: 'primary',icon: 'vxe-icon-save',disabled: false}, |
| | | |
| | | ], |
| | | slots: { |
| | | tools: 'toolbar_buttons' |
| | | }, |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | } |
| | | , |
| | | //table body实际数据 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total')+':' |
| | | } |
| | | const List = ["quantity",'grossAmount','grossArea','computeGrossArea'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | const gridEvents = { |
| | | async toolbarButtonClick({code}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'remarks': { |
| | | dialogTableVisible.value=true |
| | | break |
| | | } |
| | | case 'updateMoney': { |
| | | $grid.clearEdit() |
| | | updateMoney() |
| | | break |
| | | } |
| | | case 'Craft': { |
| | | await router.push({path: '/main/order/updateOrderCraft', query: {orderId: titleUploadData.value.orderId }}) |
| | | break |
| | | } |
| | | case 'review': { |
| | | reviewOrder(2) |
| | | break |
| | | } |
| | | case 'reviews': {//反审 |
| | | reviewOrder(0) |
| | | break |
| | | } |
| | | case 'cancelOrder':{ |
| | | cancelOrder() |
| | | break |
| | | } |
| | | case 'saveOrder': { |
| | | xGrid.value.clearEdit() |
| | | if ($grid.getTableData().tableData.length === 0){ |
| | | ElMessage.error( t('order.msg.tableLengthNot')) |
| | | return |
| | | } |
| | | computedMoney(null) |
| | | if(!gridOptions.menuConfig.body.options[0][5].disabled){ |
| | | ElMessage.error(t('order.msg.amountReset')) |
| | | return |
| | | } |
| | | |
| | | const project = titleUploadData.value.project |
| | | if(project === null || project === undefined ){ |
| | | titleUploadData.value.project='' |
| | | } |
| | | const customer = titleUploadData.value.customerId |
| | | if(customer === null || customer === undefined || customer === ''){ |
| | | ElMessage.error(t('order.msg.customerCheck')) |
| | | return |
| | | } |
| | | const salasMan = titleUploadData.value.salesman |
| | | if(salasMan === null || salasMan === undefined || salasMan === ''){ |
| | | ElMessage.error(t('order.msg.salasManCheck')) |
| | | return |
| | | } |
| | | const calculateType = titleUploadData.value.calculateType |
| | | if(calculateType === null || calculateType === undefined || calculateType === ''){ |
| | | ElMessage.error(t('order.msg.calculateTypeCheck')) |
| | | return |
| | | } |
| | | |
| | | if ($grid) { |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | |
| | | if($grid.getCheckedFilters().length!==0){ |
| | | ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst')) |
| | | return |
| | | } |
| | | //xGrid.value.clearSort() |
| | | let order ={ |
| | | title:titleUploadData.value, |
| | | detail:$grid.getTableData().visibleData, |
| | | otherMoney:otherMoney.value, |
| | | orderIdType:company.orderIdType, |
| | | creator:userStore.user.userName, |
| | | creatorId:userStore.user.userId, |
| | | newOrderId:newOrderId.value |
| | | } |
| | | const grossAreaList = $grid.getTableData().fullData.filter( |
| | | item=>item.grossArea === 0 |
| | | ) |
| | | const errorAreaList = $grid.getTableData().fullData.filter( |
| | | item=>(item.width*item.height/1000000 < errorArea.value*1) |
| | | ) |
| | | if(grossAreaList.length>0){ |
| | | alert(t('order.msg.grossAreaIsNot0')) |
| | | } |
| | | if(errorAreaList.length){ |
| | | ElMessageBox.confirm(`${t('order.msg.calculationAreaPrompt1')} |
| | | ${errorAreaList.length} |
| | | ${t('order.msg.calculationAreaPrompt2')} |
| | | ${errorArea.value} |
| | | ${t('order.msg.calculationAreaPrompt3')} |
| | | ${errorArea.value} |
| | | ${t('order.msg.calculationAreaPrompt4')}`, |
| | | t('order.msg.warning'), |
| | | { |
| | | confirmButtonText: t('basicData.confirmButtonText'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | distinguishCancelAndClose: true, |
| | | type: 'warning', |
| | | } |
| | | ).then(()=>{ |
| | | errorAreaComputed() |
| | | selectOrder(order) |
| | | }).catch((action)=>{ |
| | | if(action === 'cancel'){ |
| | | //重置结算面积 |
| | | const dataList = xGrid.value.getTableData().fullData |
| | | dataList.forEach((item,index) =>{ |
| | | item.computeArea = item.area |
| | | item.computeGrossArea = item.grossArea |
| | | }) |
| | | computedMoney(null) |
| | | selectOrder(order) |
| | | } |
| | | |
| | | }) |
| | | |
| | | }else { |
| | | selectOrder(order) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | break |
| | | } |
| | | case 'saveOrderTitle': { |
| | | if(!gridOptions.menuConfig.body.options[0][5].disabled){ |
| | | ElMessage.error(t('order.msg.amountReset')) |
| | | return |
| | | } |
| | | |
| | | const customer = titleUploadData.value.customerId |
| | | if(customer === null || customer === undefined || customer === ''){ |
| | | ElMessage.error(t('order.msg.customerCheck')) |
| | | return |
| | | } |
| | | const salasMan = titleUploadData.value.salesman |
| | | if(salasMan === null || salasMan === undefined || salasMan === ''){ |
| | | ElMessage.error(t('order.msg.salasManCheck')) |
| | | return |
| | | } |
| | | const calculateType = titleUploadData.value.calculateType |
| | | if(calculateType === null || calculateType === undefined || calculateType === ''){ |
| | | ElMessage.error(t('order.msg.calculateTypeCheck')) |
| | | return |
| | | } |
| | | |
| | | if ($grid) { |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | titleUploadData.value.creatorId=userStore.user.userId |
| | | titleUploadData.value.creator=userStore.user.userName |
| | | let order ={ |
| | | title:titleUploadData.value, |
| | | } |
| | | const errorAreaList = $grid.getTableData().fullData.filter( |
| | | item=>item.computeArea*1 < errorArea.value*1 |
| | | ) |
| | | |
| | | saveOrderTitle(order) |
| | | } |
| | | break |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | //右键按钮事件 |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | case 'deleteList': { |
| | | $grid.removeCheckboxRow() |
| | | break |
| | | } |
| | | case 'addRow': { |
| | | if ($grid.getTableData().tableData.length >=maxTableLen.value){ |
| | | ElMessage.error(t('order.msg.tableLengthMax')) |
| | | return |
| | | } |
| | | if ($grid.getCheckedFilters().length!==0){ |
| | | ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst')) |
| | | return |
| | | } |
| | | let result = toolbarButtonClickEvent() |
| | | let lengths = 0 |
| | | if (result!=null){ |
| | | lengths=result.start |
| | | } |
| | | /*console.log($grid.getTableData().tableData) |
| | | console.log($grid.getTableData().fullData)*/ |
| | | //$grid.insertAt({}, $grid.getTableData.length || -1) |
| | | if($grid.getTableData().fullData.length>lengths+1){ |
| | | $grid.insertAt({}, lengths+1) |
| | | }else{ |
| | | $grid.insertAt({}, -1) |
| | | } |
| | | break |
| | | } |
| | | case 'deleteRow':{ |
| | | // $grid.remove(rowClickIndex.value) |
| | | // rowClickIndex.value = null |
| | | // gridOptions.menuConfig.body.options[0][1].disabled=true |
| | | // gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | $grid.remove(item) |
| | | } |
| | | }) |
| | | } |
| | | computedMoney(null) |
| | | break |
| | | } |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | if(result.cell=='productName'){ |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productId"] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = val |
| | | item["productId"] = val1 |
| | | } |
| | | }) |
| | | }else if(result.cell=='productId'){ |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productName"] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = val |
| | | item["productName"] = val1 |
| | | } |
| | | }) |
| | | }else{ |
| | | |
| | | const val = getNestedProperty(dataList[result.start],result.cell) |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | setNestedValue(item,result.cell,val) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | computedMoney(result.cell) |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | xGrid.value.updateFooter() |
| | | break |
| | | } |
| | | case 'copyAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | if(result.cell=='productName'){ |
| | | |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productId"] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | item[result.cell] = val |
| | | item["productId"] = val1 |
| | | } |
| | | }) |
| | | }else if(result.cell=='productId'){ |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productName"] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | item[result.cell] = val |
| | | item["productName"] = val1 |
| | | } |
| | | }) |
| | | }else{ |
| | | const val = getNestedProperty(dataList[result.start],result.cell) |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | setNestedValue(item,result.cell,val) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | } |
| | | computedMoney(result.cell) |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | xGrid.value.updateFooter() |
| | | break |
| | | } |
| | | case 'clearChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | computedMoney(result.cell) |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | |
| | | break |
| | | } |
| | | case 'computedMoney' :{ |
| | | computedMoney(null) |
| | | |
| | | break |
| | | } |
| | | case 'errorArea' :{ |
| | | errorAreaVisible.value=true |
| | | break |
| | | } |
| | | case 'otherMoney' :{ |
| | | otherMoneyVisible.value=true |
| | | break |
| | | } |
| | | case 'sizeCheck' :{ |
| | | sizeCheckVisible.value=true |
| | | break |
| | | } |
| | | case 'updateOrderId' :{ |
| | | orderIdVisible.value=true |
| | | break |
| | | } |
| | | case 'incrementalAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = getNestedProperty(dataList[result.start],result.cell)+"" |
| | | if(!/\d$/.test(val)){ |
| | | const matches = val.match(/\D/g); |
| | | const b= val.lastIndexOf(matches[matches.length-1]) |
| | | |
| | | const numbersArr = [] |
| | | const regex = /\d+/g |
| | | let match |
| | | while ((match = regex.exec(val))) { |
| | | numbersArr.push({ number: match[0], index: match.index }); |
| | | } |
| | | let numbers=numbersArr[numbersArr.length-1] |
| | | var subStr1 = val.substring(numbers.index); |
| | | const matche = subStr1.match(/(\d+)([^0-9]|$)/); |
| | | const a= val.lastIndexOf(matche[2]) |
| | | var subStr2 = val.substring(0, numbers.index); |
| | | var subStr3 = val.substring(a,b+1); |
| | | let number = parseInt(subStr1) |
| | | var reg =new RegExp(number,"g") |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | if(!/\d$/.test(val)){ |
| | | newStr=newStr+subStr3 |
| | | } |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | | |
| | | }) |
| | | }else{ |
| | | const numbersArr = [] |
| | | const regex = /\d+/g |
| | | let match |
| | | while ((match = regex.exec(val))) { |
| | | numbersArr.push({ number: match[0], index: match.index }); |
| | | } |
| | | let numbers=numbersArr[numbersArr.length-1] |
| | | var subStr1 = val.substring(numbers.index); |
| | | var subStr2 = val.substring(0, numbers.index); |
| | | let number = parseInt(subStr1) |
| | | var reg =new RegExp(number,"g") |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | } |
| | | computedMoney(result.cell) |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | xGrid.value.updateFooter() |
| | | break |
| | | } |
| | | case 'incrementalChecked' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = getNestedProperty(dataList[result.start], result.cell)+"" |
| | | if(!/\d$/.test(val)){ |
| | | const matches = val.match(/\D/g); |
| | | const b= val.lastIndexOf(matches[matches.length-1]) |
| | | |
| | | const numbersArr = [] |
| | | const regex = /\d+/g |
| | | let match |
| | | while ((match = regex.exec(val))) { |
| | | numbersArr.push({ number: match[0], index: match.index }); |
| | | } |
| | | let numbers=numbersArr[numbersArr.length-1] |
| | | var subStr1 = val.substring(numbers.index); |
| | | const matche = subStr1.match(/(\d+)([^0-9]|$)/); |
| | | const a= val.lastIndexOf(matche[2]) |
| | | var subStr2 = val.substring(0, numbers.index); |
| | | var subStr3 = val.substring(a,b+1); |
| | | let number = parseInt(subStr1) |
| | | var reg =new RegExp(number,"g") |
| | | dataList.forEach((item,index) =>{ |
| | | if(index >= result.start && index <= result.end){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | newStr=newStr+subStr3 |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | | |
| | | }) |
| | | }else{ |
| | | const numbersArr = [] |
| | | const regex = /\d+/g |
| | | let match |
| | | while ((match = regex.exec(val))) { |
| | | numbersArr.push({ number: match[0], index: match.index }); |
| | | } |
| | | let numbers=numbersArr[numbersArr.length-1] |
| | | var subStr1 = val.substring(numbers.index); |
| | | var subStr2 = val.substring(0, numbers.index); |
| | | let number = parseInt(subStr1) |
| | | var reg =new RegExp(number,"g") |
| | | dataList.forEach((item,index) =>{ |
| | | if(index >= result.start && index <= result.end){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | | computedMoney(result.cell) |
| | | gridOptions.menuConfig.body.options[0][5].disabled = false |
| | | xGrid.value.updateFooter() |
| | | break |
| | | } |
| | | case "reportingTransfer":{ |
| | | const row = xGrid.value.getCurrentRecord() |
| | | if(row===null){ |
| | | ElMessage.warning(t('components.pleaseClickToSelectARowFirst')) |
| | | return |
| | | } |
| | | transferData.value.oldOrderNumber = row.orderNumber |
| | | transferData.value.oldOrderId = titleUploadData.value.orderId |
| | | dialogTransferVisible.value = true |
| | | break |
| | | } |
| | | case 'uploadPicture':{ |
| | | const row = xGrid.value.getCurrentRecord() |
| | | if(row===null){ |
| | | ElMessage.warning(t('components.pleaseClickToSelectARowFirst')) |
| | | return |
| | | } |
| | | rowIndex=row |
| | | alienEditorVisible.value= true |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | cellDblclick (params) {//表格内容双击打开产品界面 |
| | | const { row,column } = params |
| | | if(column.field==='productName' || column.field==='productId'){ |
| | | productVisible.value = true |
| | | rowIndex=row |
| | | } |
| | | |
| | | }, |
| | | cellClick({ row }){ |
| | | //rowClickIndex.value = row |
| | | //右键菜单删除启用 |
| | | //gridOptions.menuConfig.body.options[0][1].disabled=false |
| | | } |
| | | } |
| | | //获取子页面产品方法 |
| | | const getProductRow = (row,type) => { |
| | | if(row.state!=1){ |
| | | ElMessage.warning(t('order.msg.productStateCheck')) |
| | | return |
| | | } |
| | | if(type==1){ |
| | | rowIndex.productName = row.productName |
| | | }else{ |
| | | rowIndex.productName = row.productAbbreviation |
| | | } |
| | | rowIndex.productId = row.id |
| | | productVisible.value = false |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //初始化判断是否有id传入 |
| | | onMounted(async ()=>{ |
| | | gridOptions.loading = true |
| | | await initOrder(0) |
| | | |
| | | //异形导入 |
| | | if(!company.alienFunction){ |
| | | gridOptions.menuConfig.body.options[0][13].disabled=true |
| | | } |
| | | |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | | let productData = route.query.produceList |
| | | if (!(typeof productData === 'undefined' || productData == null || productData === '' || productData === '\n' || productData === '\r')){ |
| | | xGrid.value.insertAt(JSON.parse(productData)) |
| | | } |
| | | |
| | | const str = route.query.orderId || history.state.orderId |
| | | if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){ |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | gridOptions.loading = false |
| | | return |
| | | } |
| | | |
| | | request.post(`/order/getOrderById/${str}`).then((res) => { |
| | | if(res.code==200){ |
| | | titleUploadData.value = res.data.order |
| | | const customer = titleSelectJson.value.customer.filter(item => item.id === titleUploadData.value.customerId) |
| | | projects.value = customer[0].projectList |
| | | newOrderId.value=titleUploadData.value.orderId |
| | | if(history.state.orderId!=null){ |
| | | titleUploadData.value.orderId='' |
| | | titleUploadData.value['id']=null |
| | | titleUploadData.value['processReview']=null |
| | | titleUploadData.value['orderReview']=null |
| | | titleUploadData.value['productionOrder']=null |
| | | titleUploadData.value['processingCard']=null |
| | | titleUploadData.value['warehousing']=null |
| | | titleUploadData.value['delivery']=null |
| | | titleUploadData.value['createTime']=null |
| | | titleUploadData.value['verifierId'] = null |
| | | titleUploadData.value['verifier'] = null |
| | | |
| | | const orderDetails = res.data.orderDetails |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | |
| | | if(history.state.type=='copy'){ |
| | | xGrid.value.reloadData(orderDetails) |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | } |
| | | if(history.state.type=='copyTitle'){ |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | } |
| | | |
| | | gridOptions.loading = false |
| | | return |
| | | } |
| | | const buttonTitle = {'code': 'saveOrderTitle', |
| | | status: 'primary', |
| | | 'name': t('order.saveHeader')} |
| | | gridOptions.toolbarConfig.buttons.push(buttonTitle) |
| | | //取消工艺按钮禁用 |
| | | gridOptions.toolbarConfig.buttons[1].disabled = false |
| | | //工艺审核后保存按钮禁用 |
| | | if(res.data.order.processReview === 2){ |
| | | gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | |
| | | |
| | | } |
| | | //工艺审核后,订单未审核 取消审核按钮禁用和尺寸审核 |
| | | if(res.data.order.processReview === 2 && res.data.order.orderReview === 0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = false |
| | | //gridOptions.menuConfig.body.options[0][8].disabled =false |
| | | } |
| | | |
| | | //按钮审核过后变为反审 |
| | | if(Math.abs(res.data.order.orderReview) === 2){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = false |
| | | gridOptions.toolbarConfig.buttons[2].code='reviews' |
| | | gridOptions.toolbarConfig.buttons[2].name=t('basicData.cancelReview') |
| | | gridOptions.toolbarConfig.buttons[3].disabled = false |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | |
| | | const button = {'code': 'cancelOrder', |
| | | status: 'primary', |
| | | 'name': (res.data.order.orderReview>0?t('basicData.cancel'):t('basicData.restore'))} |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | |
| | | if(res.data.order.orderReview===-2){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | } |
| | | } |
| | | if(res.data.order.processingCard>0 && company.connectMes){ |
| | | gridOptions.menuConfig.body.options[0][12].disabled = false |
| | | } |
| | | |
| | | if(res.data.order.productionOrder !==0 ){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | | if(res.data.order.warehousing !==0 ){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | | const orderDetails = res.data.orderDetails |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | if(res.data.orderFile!=null){ |
| | | res.data.orderFile.forEach(items=>{ |
| | | if(items.order_number==item.orderNumber) |
| | | item.fileData=items.file_data |
| | | }) |
| | | } |
| | | }) |
| | | otherMoney.value =res.data.orderOtherMoneyList |
| | | //加载副表数据 |
| | | xGrid.value.reloadData(orderDetails) |
| | | gridOptions.loading = false |
| | | }else{ |
| | | ElMessage.error(res.msg) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | //作废订单 |
| | | const cancelOrder = () => { |
| | | request.post(`/order/cancelOrder/${titleUploadData.value.orderId}`).then((res) =>{ |
| | | if (res.code== 200){ |
| | | ElMessage.success(t('order.msg.updateOrderState')) |
| | | router.push({ |
| | | path:'/main/order/createOrder', |
| | | query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | }else{ |
| | | ElMessage.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | const computedMoney = (cell) => { |
| | | const dataList = xGrid.value.getTableData().fullData |
| | | dataList.forEach((item,index) =>{ |
| | | if(['width', 'height', 'quantity'].includes(cell)){ |
| | | item.area = area(item) |
| | | item.grossArea = countArea(item) |
| | | item.computeArea = item.area |
| | | item.computeGrossArea = item.grossArea |
| | | }else if(cell==='computeArea'){ |
| | | item.computeGrossArea = item.computeArea * item.quantity |
| | | } |
| | | |
| | | if(titleUploadData.value.calculateType===3){ |
| | | item.grossAmount=multiply(item.price,item.quantity) |
| | | }else if(titleUploadData.value.calculateType===4){ |
| | | item.grossAmount=parseFloat(divideAuto(item.width * item.height* item.quantity*item.price,1000000,company.decValue)) |
| | | }else{ |
| | | item.grossAmount=multiply(item.price,item.computeGrossArea) |
| | | } |
| | | |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | |
| | | gridOptions.menuConfig.body.options[0][5].disabled=true |
| | | |
| | | } |
| | | |
| | | |
| | | //页面第一次加载执行 |
| | | const initOrder = async (val)=>{ |
| | | |
| | | await request.get(`/basicData/orderBasicData`).then((res) => { |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | if(val===0){ |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.orderOtherMoney[0] |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | let column = { |
| | | field: `otherColumns.${item.column}`, |
| | | width:100, |
| | | title: item.alias, |
| | | editRender: { |
| | | name: 'input', |
| | | } |
| | | } |
| | | //判断 其他列是否是数字 |
| | | if(item.column.indexOf('M')>-1){ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,3})?|([1-9]\d{0,4})(\.\d{1,3})?|99999(\.9{1,3})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec3')) |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }else{ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ] |
| | | } |
| | | |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | |
| | | }) |
| | | } |
| | | //进入页面下拉框设置默认值 |
| | | titleUploadData.value.orderType = titleSelectJson.value.orderType[0].basicName |
| | | titleUploadData.value.orderClassify = titleSelectJson.value.orderClassify[0].basicName |
| | | titleUploadData.value.icon = titleSelectJson.value.icon[0].basicName |
| | | titleUploadData.value.packType = titleSelectJson.value.packType[0].basicName |
| | | titleUploadData.value.alType = titleSelectJson.value.alType[0].basicName |
| | | titleUploadData.value.calculateType = company.calculateType |
| | | const today = new Date |
| | | today.setTime(today.getTime() + (company.deliveryDate * 24 * 60 * 60 * 1000)) |
| | | titleUploadData.value.deliveryDate = today.getFullYear() + |
| | | '-' + ("0" + (today.getMonth() + 1)).slice(-2) |
| | | + '-' + ("0" + today.getDate()).slice(-2) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //查询重复订单方法 |
| | | const selectOrder = (order) => { |
| | | request.post(`/order/selectOrder`,order).then((res) => { |
| | | if(res.code==200){ |
| | | let orderId='' |
| | | if(res.data.data.length>0){ |
| | | for (let i=0;i<res.data.data.length;i++){ |
| | | orderId+=res.data.data[i].orderId+'|' |
| | | } |
| | | } |
| | | if(orderId!=''){ |
| | | ElMessageBox.confirm(`${t('order.msg.calculationAreaPrompt1')}, |
| | | ${orderId+t('order.msg.calculationAreaPrompt5')}`, |
| | | t('order.msg.warning'), |
| | | { |
| | | confirmButtonText: t('basicData.confirmButtonText'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | type: 'warning', |
| | | } |
| | | ).then(()=>{ |
| | | saveOrder(order) |
| | | }).catch(()=>{ |
| | | }) |
| | | }else{ |
| | | saveOrder(order) |
| | | } |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | | router.push("/login") |
| | | }) |
| | | } |
| | | |
| | | //保存订单方法 |
| | | const saveOrder = (order) => { |
| | | request.post(`/order/saveOrder`,order).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | if(titleUploadData.value.orderId.trim()===""){ |
| | | router.push({path:'/main/order/selectOrder'}) |
| | | }else{ |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | } |
| | | }else { |
| | | ElMessage.error(res.msg) |
| | | } |
| | | }).catch(()=>{ |
| | | if(titleUploadData.value.orderId.trim()!==""){ |
| | | ElMessageBox.alert(t('order.msg.updateOrderError'), 'Title', { |
| | | // if you want to disable its autofocus |
| | | // autofocus: false, |
| | | confirmButtonText: 'OK', |
| | | callback: (action: Action) => { |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | }, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //保存订单表头方法 |
| | | const saveOrderTitle = (order) => { |
| | | request.post(`/order/saveOrderTitle`,order).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | }else { |
| | | ElMessage.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //修改订单号方法 |
| | | const updateOrderId = () => { |
| | | let orderId ={ |
| | | oldOrderId:titleUploadData.value.orderId, |
| | | newOrderId:newOrderId.value, |
| | | orderIdType:company.orderIdType, |
| | | creator:userStore.user.userName, |
| | | } |
| | | request.post(`/order/updateOrderId`,orderId).then((res) => { |
| | | if(res.code==200 && res.data==="true"){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:newOrderId.value, |
| | | random:Math.random()}}) |
| | | }else if(res.data==="false1"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorGtMaxId')) |
| | | }else if(res.data==="false2"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorIsExist')) |
| | | }else if(res.data==="false3"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorIsSame')) |
| | | }else if(res.data==="false4"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorDiscrepancyInLength')) |
| | | }else if(res.data==="false5"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorInputNumber')) |
| | | }else if(res.data==="false6"){ |
| | | ElMessage.warning(t('order.msg.updateOrderIdErrorNotNo1')) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //更新金额重置 |
| | | const updateMoney = () => { |
| | | titleUploadData.value.creatorId=userStore.user.userId |
| | | titleUploadData.value.creator=userStore.user.userName |
| | | const updateData = { |
| | | order: titleUploadData.value, |
| | | detail: xGrid.value.getTableData().fullData, |
| | | otherMoney:otherMoney.value |
| | | } |
| | | request.post(`/order/updateOrderMoney`,updateData).then(res => { |
| | | if (res.code == 200){ |
| | | ElMessage.success( t('order.msg.updateAmountSuccessfully') ) |
| | | router.push({path:'/main/order/createOrder', |
| | | query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | // 审核订单 |
| | | const reviewOrder = async (state) => { |
| | | let differentSize = null |
| | | if(state===0){ |
| | | await request.post(`/order/selectDifferentSize/${titleUploadData.value.orderId}`).then(res =>{ |
| | | differentSize = res.data |
| | | }) |
| | | } |
| | | let orderGlassState = null |
| | | if(differentSize===true){ |
| | | await ElMessageBox.confirm( |
| | | t('order.msg.differentSize'), |
| | | t('order.msg.warning'), |
| | | {confirmButtonText: t('basicData.confirmButtonText'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(async () => { |
| | | |
| | | }) |
| | | .catch(async () => { |
| | | orderGlassState = false |
| | | }) |
| | | } |
| | | if (orderGlassState===false){ |
| | | return |
| | | } |
| | | |
| | | request.post(`/order/reviewOrderById/${titleUploadData.value.orderId}/${state}/${userStore.user.userId}/${userStore.user.userName}`).then(res =>{ |
| | | if(res.code==200){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | if(state==2){ |
| | | ElMessage.success(t('basicData.msg.ReviewSuccess') ) |
| | | }else if (state==0){ |
| | | ElMessage.success(t('basicData.msg.cancelReviewSuccess')) |
| | | } |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | |
| | | }else{ |
| | | ElMessage.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const gaveOrderSizeCheck = () => { |
| | | reviewOrder(2) |
| | | } |
| | | |
| | | let projects = ref([]) |
| | | |
| | | const changeProject = (item) => { |
| | | if(typeof item === 'string'){ |
| | | titleUploadData.value.project = item |
| | | return |
| | | } |
| | | titleUploadData.value.project = item.project |
| | | titleUploadData.value.salesmanId = parseInt(item.salesmanId) |
| | | titleUploadData.value.salesman = item.salesman |
| | | titleUploadData.value.contacts = item.contacts |
| | | titleUploadData.value.contactNumber = item.contactNumber |
| | | } |
| | | |
| | | const changeCustomer = () => { |
| | | const changedCustomerId = titleUploadData.value.customerId |
| | | const customer = titleSelectJson.value.customer.filter(item => item.id === changedCustomerId) |
| | | titleUploadData.value.customerName = customer[0].customerName |
| | | titleUploadData.value.project = customer[0].project |
| | | titleUploadData.value.salesmanId = customer[0].salesmanId |
| | | titleUploadData.value.salesman = customer[0].salesman |
| | | titleUploadData.value.contacts = customer[0].contacts |
| | | titleUploadData.value.contactNumber = customer[0].contactNumber |
| | | projects.value = customer[0].projectList |
| | | } |
| | | |
| | | const changeSaleMan = () => { |
| | | const changedSaleManId = titleUploadData.value.salesmanId |
| | | const SaleMan = titleSelectJson.value.saleMan.filter(item => item.id === changedSaleManId) |
| | | titleUploadData.value.salesman = SaleMan[0]['basicName'] |
| | | } |
| | | |
| | | const area = (row) => { |
| | | return parseFloat(divideAuto(row.width * row.height,1000000,company.decValue)) |
| | | } |
| | | const countArea = (row) => { |
| | | const area = parseFloat(divideAuto(row.width * row.height,1000000,company.decValue)) |
| | | let areaSum = 0 |
| | | // 获取保留面积, |
| | | const decValue = company.decValue |
| | | switch (titleUploadData.value.calculateType){ |
| | | case 2 :{ |
| | | areaSum = parseFloat(divideAuto(row.width * row.height* row.quantity,1000000,company.decValue)) |
| | | break |
| | | } |
| | | case 4:{ |
| | | areaSum = parseFloat(divideAuto(row.width * row.height* row.quantity,1000000,company.decValue)) |
| | | break |
| | | } |
| | | default :{ |
| | | areaSum = parseFloat(multiplyAuto(area ,row.quantity,company.decValue)) |
| | | break |
| | | } |
| | | } |
| | | return areaSum |
| | | } |
| | | //计算金钱 |
| | | const countMoney = (list) => { |
| | | let countMoney = 0 |
| | | list.forEach((item)=>{ |
| | | countMoney += parseFloat(item.grossAmount) |
| | | }) |
| | | return parseFloat((countMoney).toFixed(2)) |
| | | } |
| | | //导入功能 |
| | | const importEvent = async () => { |
| | | const $grid = xGrid.value |
| | | const { files } = await $grid.readFile({ |
| | | types: ['xls', 'xlsx'] |
| | | }) |
| | | const fileReader = new FileReader() |
| | | fileReader.onload = (event) => { |
| | | const data = event.target ? event.target.result : '' |
| | | const workbook = XLXS.read(data, { type: 'binary' }) |
| | | let jsonData = XLXS.utils.sheet_to_json(workbook.Sheets.Sheet1).slice(1) |
| | | |
| | | if(jsonData.length>maxTableLen.value){ |
| | | ElMessage.error(`${t('order.msg.importMaxCheckFailFirst')} |
| | | ${jsonData.length} |
| | | ${t('order.msg.importMaxCheckFailMid')} |
| | | ${t('order.msg.importMaxCheckFailLast')}`) |
| | | return |
| | | } |
| | | jsonData.forEach((item,index) => { |
| | | for(let key in item){ |
| | | if(key.indexOf('.')!==-1){ |
| | | const value = item[key]; |
| | | delete item[key]; // 删除原有的属性 |
| | | setNestedProperty(item, key, value); |
| | | } |
| | | } |
| | | |
| | | if(item.computeArea === undefined){ |
| | | item.computeArea = area(item) |
| | | }else{ |
| | | item.computeGrossArea = item.computeArea * item.quantity |
| | | } |
| | | item.area = area(item) |
| | | item.grossArea = countArea(item) |
| | | const decValue = company.decValue |
| | | |
| | | if(titleUploadData.value.calculateType===1){ |
| | | item.computeGrossArea = parseFloat(multiplyAuto(item.computeArea,item.quantity,decValue)) |
| | | }else if(titleUploadData.value.calculateType===2){ |
| | | item.computeGrossArea = item.grossArea |
| | | } |
| | | if(titleUploadData.value.calculateType===3){ |
| | | item.grossAmount=multiply(item.price , item.quantity) |
| | | }else if(titleUploadData.value.calculateType===4){ |
| | | item.grossAmount=parseFloat(divideAuto(item.width * item.height* item.quantity*item.price,1000000,company.decValue)) |
| | | }else{ |
| | | item.grossAmount=multiply(item.price * 1 , item.computeGrossArea) |
| | | } |
| | | |
| | | }) |
| | | //赋值表头数据 |
| | | titleUploadData.value.money=countMoney(jsonData).toString() |
| | | xGrid.value.loadData(jsonData) |
| | | } |
| | | fileReader.readAsBinaryString(files[0]) |
| | | } |
| | | |
| | | //模板下载 |
| | | const importTemplate = () => { |
| | | downLoadFile('/importTemplate.xlsx','importTemplate.xlsx') |
| | | } |
| | | |
| | | function setNestedProperty(obj, path, value) { |
| | | const keys = path.split('.'); |
| | | const lastKey = keys.pop(); |
| | | let cursor = obj; |
| | | |
| | | keys.forEach(key => { |
| | | cursor = cursor[key] !== undefined ? cursor[key] : (cursor[key] = {}); |
| | | }); |
| | | |
| | | cursor[lastKey] = value; |
| | | } |
| | | |
| | | |
| | | //字符串转object |
| | | |
| | | function getNestedProperty(obj, path) { |
| | | return path.split('.').reduce(function(o, p) { |
| | | if(o && o.hasOwnProperty(p)) { |
| | | return o[p]; |
| | | } |
| | | }, obj); |
| | | } |
| | | |
| | | function setNestedValue(obj, path, value) { |
| | | const keys = path.split('.'); |
| | | const lastKey = keys.pop(); |
| | | const lastObj = keys.reduce((obj, key) => obj[key], obj); |
| | | lastObj[lastKey] = value; |
| | | } |
| | | |
| | | |
| | | //行单元格修改修改触发此事件 |
| | | const editClosedEvent = ({ row, column }) => { |
| | | |
| | | //判断修改相应的数值修改面积与金额 |
| | | if (['width', 'height', 'quantity', 'price'].includes(column.property)) { |
| | | if(titleUploadData.value?.orderReview!==2){ |
| | | row.area = area(row) |
| | | row.grossArea = countArea(row) |
| | | row.computeArea = row.area |
| | | row.computeGrossArea = row.grossArea |
| | | } |
| | | if(titleUploadData.value.calculateType===3){ |
| | | row.grossAmount=multiply(row.price ,row.quantity) |
| | | }else if(titleUploadData.value.calculateType===4){ |
| | | row.grossAmount=parseFloat(divideAuto(row.width * row.height* row.quantity*row.price,1000000,company.decValue)) |
| | | }else{ |
| | | row.grossAmount=multiply(row.price , row.computeGrossArea) |
| | | } |
| | | |
| | | }else if(column.property === 'computeArea'){ |
| | | if(titleUploadData.value.calculateType!==3){ |
| | | if(titleUploadData.value?.orderReview!==2){ |
| | | row.computeGrossArea = row.computeArea * row.quantity |
| | | } |
| | | row.grossAmount=multiply(row.price , row.computeGrossArea) |
| | | } |
| | | |
| | | } |
| | | // else if(column.property.indexOf('otherColumns.M')>-1){ |
| | | // let quantity = 0 |
| | | // xGrid.value.getTableData().fullData.forEach(item => { |
| | | // let orderQuantity = isNaN(item.quantity) ? 0 : item.quantity |
| | | // let value = isNaN((getNestedProperty(item,column.property)*1)) ? 0 : (getNestedProperty(item,column.property)*1) |
| | | // quantity += orderQuantity*value |
| | | // }) |
| | | // if(!isNaN(quantity)){ |
| | | // otherMoney.value.forEach(item => { |
| | | // if(item.column===column.property.split('.')[1]){ |
| | | // item.quantity = quantity |
| | | // } |
| | | // }) |
| | | // } |
| | | // } |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | xGrid.value.updateFooter() |
| | | |
| | | } |
| | | |
| | | const cellStyle = ({ row, column }) => { |
| | | if(company.longSide!=null){ |
| | | if (column.field === 'width') { |
| | | if (row.width > parseInt(company.longSide)) { |
| | | return { |
| | | backgroundColor: '#ec6969' |
| | | } |
| | | } |
| | | } |
| | | if (column.field === 'height') { |
| | | if (row.height > parseInt(company.longSide)) { |
| | | return { |
| | | backgroundColor: '#ec6969' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | //误差面积计算方法 |
| | | const errorAreaComputed = () => { |
| | | const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | | if (!regex.test(errorArea.value.toString())) { |
| | | ElMessage.warning(t('basicData.msg.range99999Dec2')) |
| | | return |
| | | } |
| | | const fullData = xGrid.value.getTableData().fullData |
| | | if (!fullData.length){ |
| | | ElMessage.warning(t('basicData.msg.noProductDataInTheTable')) |
| | | } |
| | | fullData.forEach((item,index) => { |
| | | let trueArea = item.width*item.height/1000000 |
| | | if( !isNaN(item.computeArea*1) && item.computeArea != null && trueArea < errorArea.value){ |
| | | |
| | | item.computeArea = errorArea.value |
| | | item.computeGrossArea = parseFloat(multiply(item.computeArea,item.quantity)) |
| | | item.grossAmount=parseFloat(multiply(item.price , item.computeGrossArea)) |
| | | } |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | errorAreaVisible.value= false |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //关闭其他金额界面 |
| | | const refOtherMoney = ref() |
| | | const closeOtherMoneyDialog = async (done) => { |
| | | const flag = await refOtherMoney.value.validate() |
| | | if(flag){ |
| | | done() |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | } |
| | | } |
| | | |
| | | //关闭异形编辑界面 |
| | | const refAlienEditor = ref() |
| | | const closeAlienEditorDialog = async (done) => { |
| | | const flag = await refAlienEditor.value.validate() |
| | | if(flag){ |
| | | done() |
| | | } |
| | | } |
| | | //改变计算方式 |
| | | const changeCalculateType = ()=>{ |
| | | const fullData = xGrid.value.getTableData().fullData |
| | | if(fullData.length===0){ |
| | | return |
| | | } |
| | | fullData.forEach((item) => { |
| | | |
| | | if( !isNaN(item.computeArea*1) && item.computeArea != null ){ |
| | | if(titleUploadData.value.calculateType===3){ |
| | | item.grossAmount=parseFloat(multiply(item.price , item.quantity)) |
| | | }else if(titleUploadData.value.calculateType===4){ |
| | | if(titleUploadData.value?.orderReview!==2){ |
| | | item.grossArea = countArea(item) |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat(divideAuto(item.width * item.height* item.quantity*item.price,1000000,company.decValue)) |
| | | }else{ |
| | | item.grossAmount=parseFloat(divideAuto(item.width * item.height* item.quantity*item.price,1000000,company.decValue)) |
| | | } |
| | | |
| | | }else{ |
| | | if(titleUploadData.value?.orderReview!==2){ |
| | | item.grossArea = countArea(item) |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat(multiply(item.price , item.computeGrossArea)) |
| | | }else{ |
| | | item.grossAmount=parseFloat(multiply(item.price , item.computeGrossArea)) |
| | | } |
| | | |
| | | } |
| | | } |
| | | }) |
| | | titleUploadData.value.money=countMoney(fullData).toString() |
| | | |
| | | } |
| | | |
| | | //表格回车,在表格最后一行添加一行空数据 |
| | | const handleKeyDown =async (evnt) =>{ |
| | | //判断表示是否为筛选状态 |
| | | if(xGrid.value.isFilter()){ |
| | | return |
| | | } |
| | | const length = xGrid.value.getTableData().fullData.length |
| | | if(length>maxTableLen.value){ |
| | | ElMessage.warning(t('basicData.msg.tableDataExceedsMaximumLimit')) |
| | | return |
| | | } |
| | | if(evnt.$event.keyCode === 13 ){ |
| | | const { rowIndex,row,column } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord() |
| | | let nextRowIndex = xGrid.value.getRowIndex(row) + 1 |
| | | |
| | | |
| | | switch (column.field){ |
| | | case 'width': |
| | | xGrid.value.setSelectCell(row, 'height') |
| | | break; |
| | | case 'height': |
| | | xGrid.value.setSelectCell(row, 'quantity') |
| | | break; |
| | | case 'quantity': |
| | | if(nextRowIndex === length){ |
| | | await editClosedEvent({row,column}) |
| | | xGrid.value.clearEdit() |
| | | let rowNext = row |
| | | delete rowNext._X_ROW_KEY |
| | | //xGrid.value.insertAt(rowNext, xGrid.value.getTableData.length || -1) |
| | | xGrid.value.insertAt({}, xGrid.value.getTableData.length || -1) |
| | | } |
| | | const nextRow = xGrid.value.getTableData().fullData[nextRowIndex] |
| | | xGrid.value.setCurrentRow(nextRow) |
| | | xGrid.value.scrollToRow(nextRow) |
| | | xGrid.value.setSelectCell(nextRow, 'width') |
| | | break; |
| | | default: |
| | | if(nextRowIndex === length){ |
| | | xGrid.value.insertAt({}, xGrid.value.getTableData.length || -1) |
| | | } |
| | | const nextRow1 = xGrid.value.getTableData().fullData[nextRowIndex] |
| | | xGrid.value.setCurrentRow(nextRow1) |
| | | xGrid.value.scrollToRow(nextRow1) |
| | | xGrid.value.setSelectCell(nextRow1, column.field) |
| | | break; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /*if (nextRowIndex < xGrid.value.getTableData().fullData.length) { |
| | | xGrid.value.setCurrentRow(xGrid.value.getTableData().fullData[nextRowIndex]); |
| | | } |
| | | if(rowIndex === length-1){ |
| | | xGrid.value.insertAt({}, xGrid.value.getTableData.length || -1) |
| | | }*/ |
| | | |
| | | } |
| | | if(evnt.$event.keyCode === 38 ){ |
| | | const { rowIndex,row,column } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord() |
| | | let nextRowIndex = xGrid.value.getRowIndex(row) - 1; |
| | | if (nextRowIndex < xGrid.value.getTableData().fullData.length && nextRowIndex>=0) { |
| | | xGrid.value.setCurrentRow(xGrid.value.getTableData().fullData[nextRowIndex]); |
| | | } |
| | | |
| | | } |
| | | if(evnt.$event.keyCode === 40 ){ |
| | | const { rowIndex,row,column } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord() |
| | | let nextRowIndex = xGrid.value.getRowIndex(row) + 1; |
| | | if (nextRowIndex < xGrid.value.getTableData().fullData.length) { |
| | | xGrid.value.setCurrentRow(xGrid.value.getTableData().fullData[nextRowIndex]); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | const inputFocus = ()=>{ |
| | | xGrid.value.clearSelected() |
| | | } |
| | | |
| | | //切换产品界面 |
| | | const productFlag = ref(true) |
| | | const changeProduct = (val)=>{ |
| | | productFlag.value = val |
| | | } |
| | | const closeProductDialog = ()=>{ |
| | | productFlag.value = true |
| | | } |
| | | //改变产品页面切换 |
| | | const changePage = () => { |
| | | productFlag.value = true |
| | | } |
| | | // 创建客户显示 |
| | | let createCustomerVisible = ref(false) |
| | | |
| | | //创建客户成功返回方法 |
| | | const createCustomerSuccess = async () => { |
| | | await initOrder(1) |
| | | createCustomerVisible.value = false |
| | | } |
| | | const orderNumberTransfer = () => { |
| | | router.push({ |
| | | path:'/main/order/createOrder', |
| | | query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | } |
| | | |
| | | //图片上传名称 |
| | | const getUploadPicture = async (name, fileData) => { |
| | | const row = xGrid.value.getCurrentRecord() |
| | | row.fileName = name |
| | | row.fileData = fileData |
| | | row.shape=2 |
| | | ElMessage.success("保存成功") |
| | | alienEditorVisible.value=false |
| | | |
| | | } |
| | | |
| | | const fileToBase64 = (file) => { |
| | | return new Promise((resolve, reject) => { |
| | | const reader = new FileReader(); |
| | | reader.onload = () => resolve(reader.result); |
| | | reader.onerror = reject; |
| | | reader.readAsDataURL(file); |
| | | }); |
| | | }; |
| | | |
| | | // 顶部输入的值 |
| | | const form = reactive({ |
| | | floorNo: '', |
| | | price: '', |
| | | width: '', |
| | | height: '', |
| | | quantity: '', |
| | | shape: '', |
| | | bendRadius: '', |
| | | edgingType: '' |
| | | }) |
| | | //与表格内的值对应 |
| | | const fieldMap = { |
| | | floorNo: 'buildingNumber', |
| | | price: 'price', |
| | | width: 'width', |
| | | height: 'height', |
| | | quantity: 'quantity', |
| | | shape: 'shape', |
| | | bendRadius: 'bendRadius', |
| | | edgingType: 'edgingType' |
| | | } |
| | | |
| | | function ensureCurrentRowSync() { |
| | | if (currentRow.value) return currentRow.value |
| | | |
| | | const newRow = {} |
| | | // 给所有列字段一个初始空值 |
| | | Object.values(fieldMap).forEach(col => newRow[col] = null) |
| | | |
| | | gridOptions.data.push(newRow) |
| | | currentRow.value = newRow |
| | | |
| | | // 高亮当前行 |
| | | nextTick(() => xGrid.value?.setCurrentRow(currentRow.value)) |
| | | return currentRow.value |
| | | } |
| | | |
| | | function onFormInput(key) { |
| | | const row = ensureCurrentRowSync() |
| | | const col = fieldMap[key] |
| | | if (!col) return |
| | | |
| | | row[col] = form[key] |
| | | |
| | | // 刷新这行的渲染 |
| | | xGrid.value?.reloadRow(row) |
| | | } |
| | | |
| | | function handleCellClick({ row }) { |
| | | currentRow.value = row |
| | | clearForm() |
| | | } |
| | | function handleCurrentChange({ row }) { |
| | | currentRow.value = row |
| | | clearForm() |
| | | } |
| | | |
| | | //清空input |
| | | function clearForm () { |
| | | Object.keys(form).forEach(k => form[k] = '') |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="main-div"> |
| | | <div class="order-primary" style="background-color: white"> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>*{{$t('order.project')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <!-- <el-input v-model.trim="titleUploadData.project"/>--> |
| | | <el-select v-model.trim="titleUploadData.project" |
| | | @change="changeProject" |
| | | clearable placeholder=" " allow-create filterable > |
| | | <el-option v-for="item in projects" |
| | | :label="item.project" |
| | | :value="item"/> |
| | | </el-select> |
| | | |
| | | |
| | | </el-col> |
| | | <el-col :span="2"><el-text>*{{$t('order.customers')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.customerId" |
| | | @change="changeCustomer" |
| | | filterable |
| | | clearable |
| | | placeholder=" " > |
| | | <el-option v-for="item in titleSelectJson['customer']" |
| | | :key="item.id" |
| | | :label="item.id+' '+item.customerName" |
| | | :value="item.id" |
| | | /> |
| | | <template #footer> |
| | | <el-button @click="createCustomerVisible=true" text bg size="small" > |
| | | {{$t('basicData.create')}} |
| | | </el-button> |
| | | </template> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>*{{$t('order.orderType')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.orderType" clearable placeholder="" > |
| | | <el-option |
| | | v-for="item in titleSelectJson['orderType']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName" |
| | | /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.orderClassify')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.orderClassify" clearable placeholder=" " > |
| | | <el-option |
| | | v-for="item in titleSelectJson['orderClassify']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName" |
| | | /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.icon')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.icon" clearable placeholder=" " allow-create filterable default-first-option> |
| | | <el-option v-for="item in titleSelectJson['icon']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName"/> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.packType')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.packType" clearable placeholder=" " allow-create filterable > |
| | | <el-option v-for="item in titleSelectJson['packType']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName"/> |
| | | </el-select> |
| | | </el-col> |
| | | <!-- <el-col :span="2"><el-text /></el-col>--> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>{{$t('order.orderId')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-text >{{titleUploadData.orderId}}</el-text></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.deliveryDate')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-date-picker |
| | | v-model="titleUploadData.deliveryDate" |
| | | type="date" |
| | | placeholder="" |
| | | format="YYYY/MM/DD" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.batch')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.batch"/></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.calculateType')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select @change="changeCalculateType" v-model="titleUploadData.calculateType" placeholder=" " > |
| | | <el-option :value="1" :label="t('order.areaAmountPerPiece')"/> |
| | | <el-option :value="2" :label="t('order.areaAmountAge')"/> |
| | | <el-option :value="3" :label="t('order.quantityMount')"/> |
| | | <el-option :value="4" :label="t('order.allAmount')"/> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>*{{$t('order.salesman')}}:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select |
| | | v-model="titleUploadData.salesmanId" |
| | | @change = "changeSaleMan" |
| | | clearable |
| | | placeholder=" " |
| | | > |
| | | <el-option v-for="item in titleSelectJson['saleMan']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.id"/> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text style="white-space: nowrap;">{{$t('order.alType')}}</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.alType" clearable placeholder=" " > |
| | | <el-option v-for="item in titleSelectJson['alType']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | | :value="item.basicName"/> |
| | | </el-select> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>{{$t('order.money')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-text >{{titleUploadData.money}}</el-text></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.contractId')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.contractId"/></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.customerBatch')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.customerBatch"/></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.contacts')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.contacts" /></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.contactNumber')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.contactNumber"/></el-col> |
| | | <el-col :span="2"><el-text >{{$t('order.deliveryAddress')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-input v-model="titleUploadData.deliveryAddress"/></el-col> |
| | | </el-row> |
| | | <!-- <el-row>--> |
| | | <!-- <el-col :span="2"><el-text>其他金额:</el-text></el-col>--> |
| | | <!-- <el-col :span="2"><el-text /></el-col>--> |
| | | <!-- <el-col :span="2"><el-text>其他金额备注:</el-text></el-col>--> |
| | | <!-- <el-col :span="2"><el-text /></el-col>--> |
| | | |
| | | <!-- </el-row>--> |
| | | </div> |
| | | <div class="ipDiv" style="background:#fff;height:40px;margin-top:10px"> |
| | | <el-row :gutter="6"> |
| | | <el-col :span="2">楼层编号</el-col> |
| | | <el-col :span="2"><el-input style="width: 100%" v-model="form.floorNo" @input="onFormInput('floorNo')" /></el-col> |
| | | |
| | | <el-col :span="1">单价</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.price" @input="onFormInput('price')" /></el-col> |
| | | |
| | | <el-col :span="1">宽</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.width" @input="onFormInput('width')" /></el-col> |
| | | |
| | | <el-col :span="1">高</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.height" @input="onFormInput('height')" /></el-col> |
| | | |
| | | <el-col :span="1">数量</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.quantity" @input="onFormInput('quantity')" /></el-col> |
| | | |
| | | <el-col :span="1">形状</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.shape" @input="onFormInput('shape')" /></el-col> |
| | | |
| | | <el-col :span="2">弯钢半径</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.bendRadius" @input="onFormInput('bendRadius')" /></el-col> |
| | | |
| | | <el-col :span="2">磨边类型</el-col> |
| | | <el-col :span="1"><el-input style="width: 100%" v-model="form.edgingType" @input="onFormInput('edgingType')" /></el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="order-detail"> |
| | | <vxe-grid |
| | | height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @keydown="handleKeyDown" |
| | | @edit-closed="editClosedEvent" |
| | | :cell-style="cellStyle" |
| | | @cell-click="handleCellClick" |
| | | @current-change="handleCurrentChange" |
| | | > |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="text" |
| | | v-model="option.data" |
| | | @focus="inputFocus" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #toolbar_buttons> |
| | | <vxe-button @click="importTemplate">{{$t('order.template')}}</vxe-button> |
| | | <vxe-button @click="importEvent">{{$t('order.import')}}</vxe-button> |
| | | </template> |
| | | <template #default_shape="{ row }"> |
| | | <span>{{ row.shape=='1'? t('order.universalShape'):row.shape=='2'? t('order.alien'):null }}</span> |
| | | </template> |
| | | <template #shape_edit="{ row }"> |
| | | <vxe-select v-model="row.shape" transfer :options="shapeList" placeholder=" "/> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <el-dialog v-model="dialogTableVisible" :draggable="true" :title="$t('order.processingNote')" style="width: 60%;height:75% "> |
| | | <el-input |
| | | v-model="titleUploadData.processingNote" |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 20 }" |
| | | /> |
| | | </el-dialog> |
| | | <el-dialog id="product" |
| | | class="product1" |
| | | v-model="productVisible" |
| | | @closed="closeProductDialog" |
| | | style="width: 80%;height:75%; "> |
| | | <template #header > |
| | | <div class="my-header"> |
| | | <el-button @click="changeProduct(true)">{{$t('basicData.search')}}</el-button> |
| | | <el-button @click="changeProduct(false)">{{$t('basicData.create')}}</el-button> |
| | | </div> |
| | | </template> |
| | | <select-product v-if="productFlag" :rowIndex="rowIndex" @getProductRow="getProductRow" style="width: 100%;height: 100%" /> |
| | | <create-product v-else |
| | | :productFlag="productFlag" |
| | | @changePage="changePage" |
| | | style="text-align: left;background-color: #D5EAFF;"/> |
| | | </el-dialog> |
| | | <!--误差结算--> |
| | | <el-dialog v-model="errorAreaVisible" style="width: 300px;height:150px "> |
| | | <el-row> |
| | | <el-col :span="10"> |
| | | <el-input |
| | | v-model="errorArea" |
| | | :placeholder="$t('order.errorValue')" |
| | | /> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-button @click="errorAreaComputed">{{$t('basicData.confirmButtonText')}}</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </el-dialog> |
| | | <el-dialog v-model="orderIdVisible" style="width: 300px;height:150px "> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-input v-model="newOrderId"/> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-button @click="updateOrderId">{{$t('basicData.confirmButtonText')}}</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </el-dialog> |
| | | <el-dialog v-model="otherMoneyVisible" |
| | | :title="$t('basicData.otherAmounts')" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | :before-close="closeOtherMoneyDialog" |
| | | style="width: 614px;height:445px "> |
| | | <order-other-money |
| | | ref="refOtherMoney" |
| | | :otherMoney="otherMoney" |
| | | style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | <!--异形导入--> |
| | | <el-dialog v-model="alienEditorVisible" |
| | | :title="$t('')" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | destroy-on-close |
| | | style="width: 614px;height:470px "> |
| | | <update-alien-editor |
| | | ref="refAlienEditor" |
| | | :rowIndex="rowIndex" |
| | | @getUploadPicture="getUploadPicture" |
| | | style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | |
| | | <!-- 尺寸审核窗口--> |
| | | <el-dialog |
| | | id="sizeCheck" |
| | | v-model="sizeCheckVisible" |
| | | :draggable="true" |
| | | :title="$t('basicData.sizeReview')" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | style="width: 614px;height:445px " |
| | | > |
| | | <order-size-check |
| | | @getParent="gaveOrderSizeCheck" |
| | | :orderId="titleUploadData.orderId" |
| | | :OrderDetail="xGrid"/> |
| | | <!-- <create-customer/>--> |
| | | </el-dialog> |
| | | <!-- 客户创建窗口--> |
| | | <el-dialog |
| | | id="createCustomer" |
| | | :title="$t('customer.page.createCustomer')" |
| | | v-model="createCustomerVisible" |
| | | style="width: 700px;height:445px;text-align: left " |
| | | > |
| | | <create-customer :getOrderPage="'order'" @getOrderFunction="createCustomerSuccess" /> |
| | | </el-dialog> |
| | | |
| | | <!-- 订单报工转移--> |
| | | <el-dialog v-model="dialogTransferVisible" |
| | | :close-on-click-modal="false" |
| | | :title="$t('order.orderTransfer')" |
| | | destroy-on-close width="500"> |
| | | <order-number-report-transfer :transferData="transferData" @orderNumberTransfer="orderNumberTransfer"/> |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="uploadPictureVisible" |
| | | :close-on-click-modal="false" |
| | | destroy-on-close width="500"> |
| | | <upload-picture /> |
| | | </el-dialog> |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .main-div { |
| | | width: 100%; |
| | | height: 100%; |
| | | text-align: center; |
| | | } |
| | | .el-col{ |
| | | border: #181818 1px solid; |
| | | } |
| | | :deep(.order-primary .el-input__wrapper) { |
| | | box-shadow: 0 0 0 0 var(--el-input-border-color, var(--el-border-color)) inset; |
| | | cursor: default; |
| | | border: none !important; |
| | | background-color: transparent; |
| | | } |
| | | .order-primary{ |
| | | width: 100%; |
| | | } |
| | | .order-detail{ |
| | | width: 100%; |
| | | height: 72%; |
| | | } |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | transform: translateZ(0); |
| | | } |
| | | :deep(#product .el-dialog__body){ |
| | | height: 90%; |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(#sizeCheck .el-dialog__body,#createCustomer .el-dialog__body){ |
| | | height: 90%; |
| | | width: 100%; |
| | | } |
| | | .my-header { |
| | | display: flex; |
| | | /*flex-direction : row; |
| | | justify-content: space-between;*/ |
| | | } |
| | | </style> |