廖井涛
2025-02-18 b95bdc2199e991c4643814663a005c5e0e7d5048
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -1,5 +1,5 @@
<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"
@@ -145,7 +145,7 @@
    trigger: 'dblclick',
    mode: 'cell',
    showStatus: true,
    showIcon:false
    showIcon:false,
  },//表头参数
  columns:[
    {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 },
@@ -755,6 +755,8 @@
  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=''
@@ -1002,7 +1004,9 @@
  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)
    }
@@ -1116,6 +1120,20 @@
  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)
@@ -1123,12 +1141,15 @@
  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) => {
@@ -1254,7 +1275,6 @@
//行单元格修改修改触发此事件
const editClosedEvent = ({ row, column }) => {
  //判断修改相应的数值修改面积与金额
   if (['width', 'height', 'quantity', 'price'].includes(column.property)) {
     if(titleUploadData.value?.orderReview!==2){
@@ -1294,7 +1314,6 @@
   //   }
   // }
  titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString()
}
@@ -1377,7 +1396,7 @@
}
//表格回车,在表格最后一行添加一行空数据
const handleKeyDown = (evnt) =>{
const handleKeyDown =async (evnt) =>{
  //判断表示是否为筛选状态
  if(xGrid.value.isFilter()){
    return
@@ -1401,7 +1420,12 @@
        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)
@@ -1480,7 +1504,18 @@
    <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"
@@ -1647,7 +1682,7 @@
      </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"