NNowhZzU
2023-12-25 fcd7ece15a86fc0cb526ee801ff8262b0db22dee
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectOrderList.vue
@@ -1,61 +1,165 @@
<script setup>
import {CirclePlus, Search} from "@element-plus/icons-vue";
import {useRouter} from 'vue-router'
import {Search} from "@element-plus/icons-vue"
import {useRouter} from "vue-router"
import {reactive, ref} from "vue";
const router = useRouter()
let router = useRouter()
let deliveryTitle = $ref([
  '序号',
  '销售单号',
  '客户编号',
  '客户名称',
  '总数量',
  '可用库存',
  '项目名称',
  '批次',
  '总金额',
  '结算总面积',
  '报表日期',
  '包装方式',
  '订单类型',
  '送货地址',
  '业务员'
])
let deliveryList =[
  {
    '0': '1',
    '1': 'NG23110101',
    '2': '11',
    '3': '中建',
    '4': '534',
    '5': '116',
    '6': '黄石有轨电车',
    '7': '20批',
    '8': '111100.02',
    '9': '1008.38',
    '10': '2023-10-30',
    '11': '叉车木箱',
    '12': '普通订单',
    '13': '',
    '14': '王龙'
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/delivery/createDelivery', query: { deliveryID: 'JG24010101' }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
]
let listName = $ref([
  '下单','工艺','审核','生产','交接','下达','入库','发货'
])
function addDelivery(){
  router.push({path:'/main/delivery/createDelivery'})
}
const xGrid = ref()
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  id: 'OrderList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },//表头参数
  columns:[
    {type:'expand',slots: { content:'content' },width: 50,fixed:"left"},
    {type:'checkbox',title: '选则', width: 80,fixed:"left"},
    {type: 'seq', title: '自序', width: 80 ,fixed:"left"},
    {title: '下单', width: 40, slots: { default: 'state' }},
    {title: '工艺', width: 40, slots: { default: 'state' }},
    {title: '审核', width: 40, slots: { default: 'state' }},
    {title: '生产', width: 40, slots: { default: 'state' }},
    {title: '交接', width: 40, slots: { default: 'state' }},
    {title: '下达', width: 40, slots: { default: 'state' }},
    {title: '入库', width: 40, slots: { default: 'state' }},
    {title: '发货', width: 40, slots: { default: 'state' }},
    {field: '1',width:120,  title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '2',width:120,  title: '客户编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '3',width:120,  title: '客户名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '4',width:120,  title: '总数量',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '5',width:120,  title: '可用库存',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '6',width:120,  title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '7',width:120,  title: '批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '8',width:120,   title: '总金额',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '9',width:120,  title: '结算总面积',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '10',width:120,  title: '报表日期',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '11',width:120,  title: '包装方式',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '12',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '13',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: '14',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
  ],//表头按钮
  toolbarConfig: {
    buttons: [
      {'code': 'add', 'name': '发货',status: 'primary',icon: 'vxe-icon-add'}
    ],
    import: false,
    export: true,
    print: true,
    zoom: true,
    custom: true
  },
  data:  [
    {
      '0': '1',
      '1': 'NG23110102',
      '2': '11',
      '3': '中建',
      '4': '534',
      '5': '116',
      '6': '黄石有轨电车',
      '7': '20批',
      '8': '111100.02',
      '9': '1008.38',
      '10': '2023-10-30',
      '11': '叉车木箱',
      '12': '普通订单',
      '13': '',
      '14': '王龙'
    },
    {
      '0': '1',
      '1': 'NG23110101',
      '2': '11',
      '3': '中建',
      '4': '534',
      '5': '116',
      '6': '黄石有轨电车',
      '7': '20批',
      '8': '111100.02',
      '9': '1008.38',
      '10': '2023-10-30',
      '11': '叉车木箱',
      '12': '普通订单',
      '13': '',
      '14': '王龙'
    }
  ],//table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
        }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
        // }
        return ''
      })
    ]
  }
})
const gridEvents = {
  toolbarButtonClick ({ code }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'add': {
          router.push({path: '/main/delivery/createDelivery', params: { orderID: 'NG24010101' }})
          break
        }
      }
    }
  }
}
</script>
<template>
  <div>
  <div  style="width: 100%;height: 100%">
    <el-date-picker
        v-model="value1"
        type="daterange"
@@ -63,44 +167,47 @@
        end-placeholder="结束时间"
    />
    <el-button style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">查询</el-button>
    <el-button @click="addDelivery" style="margin-top: -5px"  id="searchButton" type="primary" :icon="CirclePlus">发货</el-button>
    <el-table
        :data="deliveryList"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        lazy
        border
        style="width: 99%;"
        max-height="80vh">
      <el-table-column type="expand" fixed>
        <template #default="props" >
          <div m="4">
            <p m="t-0 b-2">订单发货有关所有信息</p>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="选择" fixed width="40"  >
        <el-checkbox />
      </el-table-column>
      <el-table-column v-for="item in listName" prop="" :label="item" width="40"   >
    <vxe-grid
        max-height="97%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <!--      下拉显示所有信息插槽-->
      <template #content="{ row}">
        <ul class="expand-wrapper">
          <li  v-for="(item,key,index) in row">
            <span style="font-weight: bold">{{key+':  '}}</span>
            <span>{{ item }}</span>
          </li>
        </ul>
      </template>
      <template #state="{ row}">
        <el-checkbox checked/>
      </el-table-column>
      </template>
      <el-table-column
          :prop="index.toString()"
          :show-overflow-tooltip='true'
          width="100" v-for="(item,index) in deliveryTitle"
          :label="item" />
    </el-table>
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>
        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>
      </template>
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </div>
      </template>
    </vxe-grid>
  </div>
</template>
<style scoped>
:deep(.el-table .el-input__wrapper) {
  box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
  cursor: default;
  border: none !important;
  background-color: transparent;
}
</style>