| | |
| | | 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 OrderOtherMoney from "@/components/sd/order/OrderOtherMoney.vue" |
| | | import OrderSizeCheck from "@/components/sd/order/OrderSizeCheck.vue" |
| | |
| | | const maxTableLen =ref(150) |
| | | let errorArea = ref(0.4) |
| | | const userStore = useUserInfoStore() |
| | | const company = companyInfo() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const xGrid = ref() |
| | |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true,gt:13 },//开启虚拟滚动 |
| | | scrollX:{ enabled: true,gt:7 },//开启虚拟滚动 |
| | | scrollY:{ enabled: true,gt:0 },//开启虚拟滚动 |
| | | scrollX:{ enabled: true,gt:0 },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | |
| | | { code: 'computedMoney', name: t('basicData.calculateAmount'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: true }, |
| | | { 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: true } |
| | | { code: 'sizeCheck', name: t('basicData.sizeReview'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false } |
| | | ] |
| | | ] |
| | | } |
| | |
| | | {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.floorNumber'),editRender: { name: 'input'},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}, |
| | |
| | | { |
| | | validator ({ cellValue }) { |
| | | //const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | | const regex = /^(0|[1-9][0-9]{0,4}([.][0-9]{1,2})?)$/ |
| | | const regex = company.widHeiLength.regexp |
| | | if (!regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec2')) |
| | | return new Error(t(company.widHeiLength.msg)) |
| | | } |
| | | } |
| | | } |
| | |
| | | height:[ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0|[1-9][0-9]{0,4}([.][0-9]{1,2})?)$/ |
| | | const regex = company.widHeiLength.regexp |
| | | if ( !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec2')) |
| | | return new Error(t(t(company.widHeiLength.msg))) |
| | | } |
| | | } |
| | | } |
| | |
| | | ElMessage.error( t('order.msg.tableLengthNot')) |
| | | return |
| | | } |
| | | computedMoney() |
| | | if(!gridOptions.menuConfig.body.options[0][5].disabled){ |
| | | ElMessage.error(t('order.msg.amountReset')) |
| | | return |
| | |
| | | ElMessage.error("请先取消筛选") |
| | | return |
| | | } |
| | | //xGrid.value.clearSort() |
| | | let order ={ |
| | | title:titleUploadData.value, |
| | | detail:$grid.getTableData().tableData, |
| | |
| | | { |
| | | confirmButtonText: t('basicData.confirmButtonText'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | distinguishCancelAndClose: true, |
| | | type: 'warning', |
| | | } |
| | | ).then(()=>{ |
| | | errorAreaComputed() |
| | | selectOrder(order) |
| | | }).catch(()=>{ |
| | | selectOrder(order) |
| | | }).catch((action)=>{ |
| | | if(action === 'cancel'){ |
| | | selectOrder(order) |
| | | } |
| | | |
| | | }) |
| | | |
| | | }else { |
| | |
| | | ) |
| | | |
| | | saveOrderTitle(order) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | break |
| | | } |
| | |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | if(result.cell=='productName'){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productId"] |
| | | dataList.forEach((item,index) =>{ |
| | |
| | | } |
| | | }) |
| | | }else if(result.cell=='productId'){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productName"] |
| | | dataList.forEach((item,index) =>{ |
| | |
| | | } |
| | | }) |
| | | }else{ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | |
| | | const val = getNestedProperty(dataList[result.start],result.cell) |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = val |
| | | setNestedValue(item,result.cell,val) |
| | | } |
| | | }) |
| | | } |
| | |
| | | case 'copyAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | if(result.cell=='productName'){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productId"] |
| | | dataList.forEach((item,index) =>{ |
| | |
| | | } |
| | | }) |
| | | }else if(result.cell=='productId'){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | const val1 = dataList[result.start]["productName"] |
| | | dataList.forEach((item,index) =>{ |
| | |
| | | } |
| | | }) |
| | | }else{ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | const val = getNestedProperty(dataList[result.start],result.cell) |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | item[result.cell] = val |
| | | setNestedValue(item,result.cell,val) |
| | | } |
| | | }) |
| | | } |
| | |
| | | break |
| | | } |
| | | case 'computedMoney' :{ |
| | | const dataList = xGrid.value.getTableData().fullData |
| | | dataList.forEach((item,index) =>{ |
| | | item.area = area(item) |
| | | item.grossArea = countArea(item) |
| | | item.computeArea = item.area |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2)) |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | computedMoney() |
| | | |
| | | gridOptions.menuConfig.body.options[0][5].disabled=true |
| | | break |
| | | } |
| | | case 'errorArea' :{ |
| | |
| | | } |
| | | } |
| | | //获取子页面产品方法 |
| | | const getProductRow = (row) => { |
| | | const getProductRow = (row,type) => { |
| | | if(row.state!=1){ |
| | | ElMessage.warning(t('order.msg.productStateCheck')) |
| | | return |
| | | } |
| | | |
| | | rowIndex.productName = row.productName |
| | | if(type==1){ |
| | | rowIndex.productName = row.productName |
| | | }else{ |
| | | rowIndex.productName = row.productAbbreviation |
| | | } |
| | | rowIndex.productId = row.id |
| | | productVisible.value = false |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | titleUploadData.value.delivery=null |
| | | titleUploadData.value.createTime=null |
| | | |
| | | const orderDetails = res.data.orderDetails |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | |
| | | if(history.state.type=='copy'){ |
| | | xGrid.value.reloadData(res.data.orderDetails) |
| | | xGrid.value.reloadData(orderDetails) |
| | | } |
| | | |
| | | gridOptions.loading = false |
| | | return |
| | | } |
| | |
| | | //工艺审核后,订单未审核 取消审核按钮禁用和尺寸审核 |
| | | 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 |
| | | //gridOptions.menuConfig.body.options[0][8].disabled =false |
| | | } |
| | | |
| | | //按钮审核过后变为反审 |
| | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | const buttonTitle = {'code': 'saveOrderTitle', |
| | | status: 'primary', |
| | | 'name': (res.data.order.orderReview>0?'保存表头':'保存表头')} |
| | | 'name': t('order.saveHeader')} |
| | | gridOptions.toolbarConfig.buttons.push(buttonTitle) |
| | | if(res.data.order.orderReview===-2){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | |
| | | } |
| | | }) |
| | | } |
| | | const computedMoney = () => { |
| | | const dataList = xGrid.value.getTableData().fullData |
| | | dataList.forEach((item,index) =>{ |
| | | item.area = area(item) |
| | | item.grossArea = countArea(item) |
| | | item.computeArea = item.area |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2)) |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | |
| | | gridOptions.menuConfig.body.options[0][5].disabled=true |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //页面第一次加载执行 |
| | |
| | | titleUploadData.value.alType = titleSelectJson.value.alType[0].basicName |
| | | titleUploadData.value.calculateType = 2 |
| | | const today = new Date |
| | | today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000)) |
| | | today.setTime(today.getTime() + (7 * 24 * 60 * 60 * 1000)) |
| | | titleUploadData.value.deliveryDate = today.getFullYear() + |
| | | '-' + ("0" + (today.getMonth() + 1)).slice(-2) |
| | | + '-' + ("0" + today.getDate()).slice(-2) |
| | |
| | | |
| | | //查询重复订单方法 |
| | | const selectOrder = (order) => { |
| | | console.log(order) |
| | | request.post(`/order/selectOrder`,order).then((res) => { |
| | | if(res.code==200){ |
| | | if(res.data.data>0){ |
| | |
| | | }) |
| | | } |
| | | |
| | | //更新金额 |
| | | //更新金额重置 |
| | | const updateMoney = () => { |
| | | const updateData = { |
| | | order: titleUploadData.value, |
| | | detail: xGrid.value.getTableData().fullData |
| | | detail: xGrid.value.getTableData().fullData, |
| | | otherMoney:otherMoney.value |
| | | } |
| | | request.post(`/order/updateOrderMoney`,updateData).then(res => { |
| | | if (res.code == 200){ |
| | |
| | | } |
| | | |
| | | const gaveOrderSizeCheck = () => { |
| | | |
| | | |
| | | |
| | | reviewOrder(2) |
| | | } |
| | | |
| | |
| | | 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} |
| | |
| | | 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) |
| | | } |
| | |
| | | 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 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; |
| | | } |
| | | |
| | | //行单元格修改修改触发此事件 |
| | |
| | | return |
| | | } |
| | | if(evnt.$event.keyCode === 13 ){ |
| | | const { rowIndex } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord() |
| | | const { rowIndex,row,column } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord() |
| | | // if(xGrid.value.getEditRecord()===null){ |
| | | // xGrid.value.setEditCell(row,column) |
| | | // } |
| | | if(rowIndex === length-1){ |
| | | xGrid.value.insertAt({}, xGrid.value.getTableData.length || -1) |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | const inputFocus = ()=>{ |
| | | xGrid.value.clearSelected() |
| | | } |
| | | |
| | | </script> |
| | |
| | | </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=" " > |
| | | <el-select v-model="titleUploadData.icon" clearable placeholder=" " allow-create filterable> |
| | | <el-option v-for="item in titleSelectJson['icon']" |
| | | :key="item.id" |
| | | :label="item.basicName" |
| | |
| | | </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=" " > |
| | | <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" |
| | |
| | | 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> |
| | |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="text" |
| | | v-model="option.data" |
| | | @focus="inputFocus" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | |
| | | > |
| | | <order-size-check |
| | | @getParent="gaveOrderSizeCheck" |
| | | :orderId="titleUploadData.orderId" |
| | | :OrderDetail="xGrid"/> |
| | | </el-dialog> |
| | | |
| | |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | transform: translateZ(0); |
| | | } |
| | | :deep(#product .el-dialog__body){ |
| | | height: 90%; |
| | |
| | | height: 90%; |
| | | width: 100%; |
| | | } |
| | | |
| | | |
| | | |
| | | </style> |