| | |
| | | <script lang="ts" setup> |
| | | import {onMounted, reactive, ref, watch} from "vue" |
| | | import {nextTick, onMounted, reactive, ref, watch} from "vue" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | import * as XLXS from "xlsx" |
| | | import {ElMessage, ElMessageBox} from "element-plus" |
| | |
| | | trigger: 'dblclick', |
| | | mode: 'cell', |
| | | showStatus: true, |
| | | showIcon:false |
| | | showIcon:false, |
| | | },//表头参数 |
| | | columns:[ |
| | | {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 }, |
| | |
| | | //初始化判断是否有id传入 |
| | | onMounted(async ()=>{ |
| | | gridOptions.loading = true |
| | | await initOrder() |
| | | await initOrder(0) |
| | | |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | |
| | | 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='' |
| | |
| | | |
| | | |
| | | //页面第一次加载执行 |
| | | const initOrder = async ()=>{ |
| | | const initOrder = async (val)=>{ |
| | | |
| | | await request.get(`/basicData/orderBasicData`).then((res) => { |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | //其他金额 |
| | | 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(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')) |
| | | //判断 其他列是否是数字 |
| | | 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') } |
| | | ] |
| | | } |
| | | ] |
| | | }else{ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ] |
| | | } |
| | | |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | |
| | | }) |
| | | |
| | | }) |
| | | } |
| | | //进入页面下拉框设置默认值 |
| | | titleUploadData.value.orderType = titleSelectJson.value.orderType[0].basicName |
| | | titleUploadData.value.orderClassify = titleSelectJson.value.orderClassify[0].basicName |
| | |
| | | request.post(`/order/saveOrderTitle`,order).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path:'/main/order/selectOrder'}) |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:titleUploadData.value.orderId, |
| | | random:Math.random()}}) |
| | | }else { |
| | | ElMessage.error(res.msg) |
| | | } |
| | |
| | | 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 = 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.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 |
| | | titleUploadData.value.salesman = SaleMan[0]['basicName'] |
| | | } |
| | | |
| | | const area = (row) => { |
| | |
| | | //行单元格修改修改触发此事件 |
| | | const editClosedEvent = ({ row, column }) => { |
| | | |
| | | |
| | | //判断修改相应的数值修改面积与金额 |
| | | if (['width', 'height', 'quantity', 'price'].includes(column.property)) { |
| | | if(titleUploadData.value?.orderReview!==2){ |
| | |
| | | // } |
| | | // } |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //表格回车,在表格最后一行添加一行空数据 |
| | | const handleKeyDown = (evnt) =>{ |
| | | const handleKeyDown =async (evnt) =>{ |
| | | //判断表示是否为筛选状态 |
| | | if(xGrid.value.isFilter()){ |
| | | return |
| | |
| | | break; |
| | | case 'quantity': |
| | | if(nextRowIndex === length){ |
| | | xGrid.value.insertAt({}, xGrid.value.getTableData.length || -1) |
| | | 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) |
| | |
| | | |
| | | //创建客户成功返回方法 |
| | | const createCustomerSuccess = async () => { |
| | | //await initOrder() |
| | | await initOrder(1) |
| | | createCustomerVisible.value = false |
| | | } |
| | | |
| | |
| | | <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-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" |
| | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <el-dialog v-model="dialogTableVisible" :title="$t('order.processingNote')" style="width: 60%;height:75% "> |
| | | <el-dialog v-model="dialogTableVisible" :draggable="true" :title="$t('order.processingNote')" style="width: 60%;height:75% "> |
| | | <el-input |
| | | v-model="titleUploadData.processingNote" |
| | | type="textarea" |