clll
2023-12-22 1f6c97aa5f23d09a04152038c7d53ce95721cf50
north-glass-erp/northglass-erp/src/views/pp/BOM/StandardBOM.vue
@@ -1,9 +1,25 @@
<script lang="ts" setup>
import {reactive, ref} from 'vue'
import {Search} from "@element-plus/icons-vue"
import {useRouter} from "vue-router"
const router = useRouter()
// do not use same name with ref
<script setup>
import {reactive} from "vue";
import {useRouter} from  'vue-router'
let router=useRouter()
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/BOM/StandardBOMDetail', query: { id: row.id }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
    case  'setType':{
      alert('我接收到子组件传送的审核状态')
      break
    }
  }
}
const form = reactive({
  name: '',
  region: '',
@@ -14,36 +30,150 @@
  resource: '',
  desc: '',
})
const defaultTime = ref<[Date, Date]>([
  new Date(2000, 1, 1, 0, 0, 0),
  new Date(2000, 2, 1, 23, 59, 59),
])
let listName = $ref([
  '基准BOM','标准BOM','审核'
])
const tableData = [
  {
    serialNumber: '1',
    2: 'D123123',
    3: 'XXXX公司',
    4: '06040000022',
    5:'10mm超白UD60平钢(外)+12Ar(结)+10mm超白平钢(内)',
    6:'1440',
    7:'3660',
    8:'30',
    9:'普形',
    10:'111',
    11:'张三',
    12:'李四',
    13:'王五',
//表尾求和
const sumNum = (list, field) => {
  let count = 0
  list.forEach(item => {
    count += Number(item[field])
  })
  return count.toFixed(2)
}
//子组件接收参数
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  id: 'CustomerList',
  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',fixed:"left",slots: { content:'content' },width: 50},
    { type: 'seq',fixed:"left", title: '自序', width: 50 },
    {title: '操作', width: 80, slots: { default: 'button_slot' },fixed:"left"},
    { type: 'checkbox',fixed:"left", title: '基准BOM', width: 110 },
    { type: 'checkbox',fixed:"left", title: '标准BOM', width: 110 },
    { type: 'checkbox',fixed:"left", title: '审核', width: 80 },
    {field: 'customerNumber', width: 120, title: '客户编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, },
    {field: 'customerName',width: 120, title: '客户名称', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'productNumber', width: 130,title: '产品编号', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'productName',width: 120, title: '产品名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'glassLength', width: 100,title: '玻璃长', sortable: true,showOverflow:"ellipsis"},
    {field: 'glassWidth', width: 100,title: '玻璃宽', sortable: true},
    {field: 'thickness',width: 100, title: '厚度', sortable: true},
    {field: 'shape',width: 120, title: '形状', sortable: true,showOverflow:"ellipsis"},
    {field: 'notes', width: 120,title: '备注', sortable: true},
    {field: 'productCreator',width: 120, title: '产品创建人', sortable: true},
    {field: 'BOMCreator',width: 120, title: 'BOM创建人', sortable: true},
    {field: 'auditor',width: 120, title: '审核员', sortable: true}
  ],//表头按钮
  toolbarConfig: {
    // buttons: [{
    //
    // }],
    import: false,
    export: true,
    print: true,
    zoom: true,
    custom: true
  },
  data:  [
    {
      customerNumber: 'D123123',
      customerName: 'XXXX公司',
      productNumber: '06040000022',
      productName:'10mm超白UD60平钢(外)+12Ar(结)+10mm超白平钢(内)',
      glassLength:'1440',
      glassWidth:'3660',
      thickness:'30',
      shape:'普形',
      notes:'111',
      productCreator:'张三',
      BOMCreator:'李四',
      auditor:'王五',
    },
    {
      customerNumber: 'D123123',
      customerName: 'XXXX公司',
      productNumber: '06040000022',
      productName:'10mm超白UD60平钢(外)+12Ar(结)+10mm超白平钢(内)',
      glassLength:'1440',
      glassWidth:'3660',
      thickness:'30',
      shape:'普形',
      notes:'111',
      productCreator:'张三',
      BOMCreator:'李四',
      auditor:'王五',
    },
    {
      customerNumber: 'D123123',
      customerName: 'XXXX公司',
      productNumber: '06040000022',
      productName:'10mm超白UD60平钢(外)+12Ar(结)+10mm超白平钢(内)',
      glassLength:'1440',
      glassWidth:'3660',
      thickness:'30',
      shape:'普形',
      notes:'111',
      productCreator:'张三',
      BOMCreator:'李四',
      auditor:'王五',
    },
  ],//table body实际数据
  //脚部求和
  footerMethod ({ columns, data }) {//页脚函数
    let footList=['finishedNumber','finishedArea','wornNumber','wornArea']
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
        }
        if (footList.includes(column.field)) {
          return sumNum(data, column.field)
        }
        return ''
      })
    ]
  }
})
</script>
<template>
  <div>
  <div class="main-div-customer">
    <div id="selectForm">
      <el-row :gutter="0">
        <el-date-picker
@@ -58,37 +188,50 @@
      </el-row>
    </div>
    <el-table :data="tableData" border style="width: 100%" height="100%">
      <el-table-column v-for="item in listName" prop="" :label="item" width="85"   >
        <el-checkbox checked/>
      </el-table-column>
      <el-table-column prop="serialNumber" label="自序" width="55" >
        <template v-slot="scope">
          <router-link :to="{path:'StandardBOMDetail'}" >{{scope.row.serialNumber}}</router-link>
        </template>
      </el-table-column>
      <el-table-column prop="2" label="客户编号" width="105" />
      <el-table-column prop="3" label="客户名称" width="105" />
      <el-table-column prop="4" label="产品编号" :show-overflow-tooltip='true' width="125" />
      <el-table-column prop="5" label="产品名称" :show-overflow-tooltip='true' width="150" />
      <el-table-column prop="6" label="玻璃长" width="75" />
      <el-table-column prop="7" label="玻璃宽" width="75" />
      <el-table-column prop="8" label="厚度" width="65" />
      <el-table-column prop="9" label="形状" width="65" />
      <el-table-column prop="10" label="备注" :show-overflow-tooltip='true' width="155" />
      <el-table-column prop="11" label="产品创建人" width="95" />
      <el-table-column prop="12" label="BOM创建人" width="105" />
      <el-table-column prop="13" label="审核员" width="85" />
    </el-table><!-- <h1>{{msg}}</h1> -->
    <vxe-grid
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
      <!--      下拉显示所有信息插槽-->
      <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 #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" 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>
.main-div-customer{
  width: 99%;
  height: 100%;
}
#selectForm {
  width: 40%;
  height: 100%;
  text-align: center;
}
</style>