wang
2024-03-26 9e9e7b3bd346f5189becc20fb6ac127c320ec1ee
UI-Project/src/views/mm/purchaseOrder/Select.vue
@@ -1,257 +1,753 @@
<template>
  <el-container>
    <el-header class="m-header" style="height: auto">
      <el-row :gutter="10" style="margin-bottom: 5px">
        <el-col :span="7">
          <el-date-picker
              v-model="datevalue"
              type="daterange"
              unlink-panels
              range-separator="到"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :shortcuts="shortcuts"
              :size="size"
              format="YYYY/MM/DD"
              value-format="YYYY-MM-DD"
          />
        </el-col>
        <el-col :span="2">
          <el-button
              id="select"
              type="primary"
              :icon="Search"
              @click="BtnSearchPurchaseOrder">查询
          </el-button>
        </el-col>
      </el-row>
    </el-header>
    <el-main style="padding-top: 5px;height:100%">
      <vxe-grid
          max-height="600"
          @filter-change="filterChanged"
          class="mytable-scrollbar"
          ref="xGrid"
          v-bind="gridOptions"
          v-on="gridEvents"
          @cell-dblclick="cellClickEvent"
      >
        <!--      下拉显示所有信息插槽-->
        <template #content="{ row }">
          <ul class="expand-wrapper">
            <li  v-for="(item,index) in gridOptions.columns" v-show="item.field!==undefined ">
              <span style="font-weight: bold">{{item.title+':  '}}</span>
              <span>{{ row[item.field] }}</span>
            </li>
          </ul>
        </template>
        <!--左边固定显示的插槽-->
        <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>-->
          <!--          <el-button @click="cellClickEvent" 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>
      <!--      详情框 部分1-->
      <vxe-modal v-model="showDetails" title="查看详情" width="600" height="80%" :mask="false" :lock-view="false"
                 resize>
        <el-container>
          <el-header height="35px"
                     style="margin: 0;padding: 0">
            <el-input v-model="showCGDH" placeholder="采购单号" disabled>
              <template #prepend>采购单号:</template>
            </el-input>
          </el-header>
          <el-main>
            <template #default>
              <vxe-table
                  border="inner"
                  auto-resize
                  show-overflow
                  max-height="400"
                  :row-config="{isHover: true}"
                  :show-header="false"
                  :sync-resize="showDetails"
                  :data="detailData">
                <vxe-column field="label" width="30%" class-name="v-column-label"></vxe-column>
                <vxe-column field="value"></vxe-column>
              </vxe-table>
            </template>
          </el-main>
          <el-footer height="40px">
            <el-row>
              <el-col :offset="20" :span="4">
                <el-button
                    id="Sure"
                    type="primary"
                    @click="logicExecute('编辑')"
                >编辑
                </el-button>
              </el-col>
            </el-row>
          </el-footer>
        </el-container>
      </vxe-modal>
      <!--      详情框 部分1 结束-->
    </el-main>
  </el-container>
</template>
<script setup>
import {ref} from "vue";
import {reactive} from "vue";
import {useRouter} from 'vue-router'
import {Search} from "@element-plus/icons-vue";
import dayjs from "dayjs";
import {ElMessage} from "element-plus";
import {reactive} from "vue";
import {useRouter} from "vue-router"
const router = useRouter()
let router = useRouter()
const getTableRow = (row, type) => {
  switch (type) {
    case 'edit' : {
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/purchaseOrder/CreatePurchaseOrder', query: {id: row.id}})
      break
    }
    case 'delete': {
      alert('我接收到子组件传送的删除信息' + row.id)
      break
    }
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
const dialogFormVisible = ref(false)
const dialogFormVisiblea = ref(false)
const box = ref(true)
const boxa = ref(false)
const boxb = ref(false)
const tableData = [
  {
    id: '1',
    long: '1005',
    wide: '183.6',
    thick: '1991',
    type: '待识别',
    typea: '1',
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  }
}
const xGrid = ref()
const gridEvents = {
  toolbarButtonClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'Add': {//新增
          router.push({path: '/main/purchaseOrder/CreatePurchaseOrder'})
          break
        }
        case 'AddNo': {//无单新增
          MessageShow('点击了无单新增', 'success');
          break
        }
      }
    }
]
const tableDataa = [
  {
    ida: '3',
    longa: '1005',
    widea: '183.6',
    thicka: '1991',
  },
  toolbarToolClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'myPrint': {
          $grid.print()
          break
        }
      }
  {
    ida: '4',
    longa: '105',
    widea: '183',
    thicka: '191',
  }
]
const open = () => {
  ElMessageBox.confirm(
    '是否删除该条信息?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  },
}
const BtnSearchPurchaseOrder = () => {
  for (let i = 1; i < 6; i++) {
    const randomInt = Math.floor(Math.random() * 999) + 1000;//4位数随机数
    const randomSumInt = Math.floor(Math.random() * 99) + 10;//2位数随机数
    const randomOrderInt = Math.floor(Math.random() * 99) + 100;//3位数随机数
    const t = i % 2 === 0 ? 5 : 6;
    const s = i % 2 === 0 ? '入库' : i % 3 === 0 ? '待审核' : i % 5 === 0 ? '已采购' : '退库';
    const CGNo = 'NGCG231200' + randomOrderInt;//采购编号
    const wlNo = 'NGWL1000' + randomInt;
    const xh = 'NGXH' + randomSumInt;
    const wlmc = 'WLMC' + randomInt;
    const gys = '供应商' + randomSumInt;
    const xhdh = 'NG231200' + randomOrderInt;
    const w = i % 2 === 0 ? '3300' : i % 3 === 0 ? '3660' : i % 4 === 0 ? '2250' : '2580';
    const h = i % 2 === 0 ? '2440' : i % 3 === 0 ? '2440' : i % 4 === 0 ? '2000' : '2300';
    const dw = i % 2 === 0 ? '片' : i % 3 === 0 ? '平米' : i % 4 === 0 ? '包' : '吨';
    now.setDate(now.getDate() + 1);
    gridOptions.data.push({
      cgdh: CGNo,
      h: t,
      xh: xh,
      wlbh: wlNo,
      wlmc: wlmc,
      gys: gys,
      w: w,
      g: h,
      dw: dw,
      cgzt: s,
      rq: dayjs(now).format('YYYY-MM-DD'),
      yl: randomSumInt,
      sl: randomOrderInt,
      xsdh: xhdh,
      je: randomInt,
      6: '139xxxxxxxx',
  )
    .then(() => {
      ElMessage({
        type: 'success',
        message: '删除成功!',
      })
    })
  }
    .catch(() => {
      ElMessage({
        type: 'info',
        message: '删除失败',
      })
    })
}
//页面逻辑代码执行
function logicExecute(type) {
  const $grid = xGrid.value
const getTableRow = (row,type) =>{
  switch (type) {
    case '编辑':
      //MessageShow('操作成功!', 'success');
      //编辑逻辑代码TODO
      router.push({path: '/main/purchaseOrder/CreatePurchaseOrder'})
      break;
    case '退货':
      //单退货逻辑代码TODO
      MessageShow('操作成功!', 'success');
      break;
    default:
      MessageShow('未知操作!', 'error');
      break;
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
  return true;
}
//组件接收参数
const dialogForm = () => {
  ElMessageBox.confirm(
    '是否切换版图?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
  .then(() => {
    // this.boxa = true
    // this.box = false
    })
}
const selectedRows = ref([]);
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
const showMessage = () => {
  if (selectedRows.value.length === 0) {
    ElMessage('请至少选择一个选项')
  } else{
    ElMessage({
    message: '重新识别成功!',
    type: 'success',
  })
  }
};
const pick = () => {
  if (selectedRows.value.length === 0) {
    ElMessage('请至少选择一个选项')
  } else{
    ElMessage({
    message: '人工匹配成功!',
    type: 'success',
  })
  }
};
const remove = () => {
  if (selectedRows.value.length === 0) {
    ElMessage('请至少选择一个选项')
  } else{
    ElMessage({
    message: '操作成功!',
    type: 'success',
  })
  }
};
const gridOptions = reactive({
  border: "full",//表格加边框
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe: true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true, height: 50},//鼠标移动或选择高亮
  id: 'CustomerList',
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  id: 'OrderList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY: {enabled: true},//开启虚拟滚动
  showOverflow: true,
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
@@ -267,296 +763,155 @@
    mode: 'row',
    showStatus: true
  },
  columns: [
    {type: 'expand', title: '', fixed: "left", slots: {content: 'content'}, width: 50},//详情
    {title: '操作', width: '8%', slots: {default: 'button_slot'}, fixed: "left"},
    /* {type: 'checkbox',fixed:"left", title: '', width: 50 },*/
    {type: 'seq', fixed: "left", title: ' ', width: 50},
  data:  [
    {
      field: 'cgdh',
      width: '10%',
      title: '采购单号',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'cgzt', width: '10%', title: '状态', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: 'gys',
      width: '10%',
      title: '供应商',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: 'wlbh',
      width: '10%',
      title: '物料编号',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: 'wlmc',
      width: '10%',
      title: '物料名称',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'w', width: '8%', title: '宽度', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'g', width: '8%', title: '高度', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'h', width: '8%', title: '厚度', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'xh', width: '8%', title: '型号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'dw', width: '8%', title: '单位', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: '6',
      width: '12%',
      title: '不含税单价',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'sl', width: '8%', title: '数量', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: 'sl',
      width: '12%',
      title: '已采购数量',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'je', width: '8%', title: '金额', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: 'je',
      width: '12%',
      title: '不含税金额',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: '6', width: '8%', title: '税率', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'sl', width: '8%', title: '库存', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'yl', width: '10%', title: '周用量', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'yl', width: '10%', title: '月用量', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: 'cgzt',
      width: '10%',
      title: '单据状态',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: 'xsdh',
      width: '10%',
      title: '销售单号',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: 'rq',
      width: '10%',
      title: '制单日期',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: '6', width: '10%', title: '制单人', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: '6',
      width: '10%',
      title: '采购部门',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: '6',
      width: '10%',
      title: '采购组织',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: '6', width: '10%', title: '备注', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true}
  ],//表头参数
  toolbarConfig: {
    buttons: [/*{type:'text'},
      {
      'name': '创建订单',
      'code':'Add',
    },
      {
        'name': '无单新增',
        'code':'AddNo'
      }*/
    ],
    import: false,
    export: true,
    print: true,
    zoom: true,
    custom: true,
    style: 'paddling-left:10px'
  },//表头按钮
  data: [],//table body实际数据
  mergeFooterItems: [
    {row: 0, col: 0, rowspan: 1, colspan: 4}
  ],//合并脚
  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 ''
      })
    ]
  },
})
//详情框 部分2
const showCGDH = ref();
const showDetails = ref(false);
let detailData = [];
const cellClickEvent = ({row}) => {
  if(isQueryColumnId===false){
    queryColumnId();
  }
  detailData = list.map(field => {
    return {label: queryColumnsTitle(field), value: row[field]}
  })
  showDetails.value = true;
  showCGDH.value = row['cgdh'];
}
//获取表列
let list = [];
let columnIndex = 3;//列标头从第几列开始的
let isQueryColumnId = false;
const queryColumnId = () => {
  while (columnIndex < gridOptions.columns.length) {
    list.push(gridOptions.columns[columnIndex].field);
    columnIndex++;
  }
  isQueryColumnId = true;
  return list;
}
//获取表列名
function queryColumnsTitle(cn) {
  let i = 0;
  while (i < gridOptions.columns.length + 1) {
    if (gridOptions.columns[i].field === cn) {
      return gridOptions.columns[i].title;
      'id': '1',
      'long': '5',
      'wide': '1005',
      'thick': '183.6',
    }
    i++;
  }
}
//详情框 部分2 结束
const now = new Date()
//时间快捷选择
const datevalue = ref('')
const shortcuts = [
  {
    text: '近一周',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: '近一个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: '近三个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
]
//提示信息
//信息内容,显示方式,显示标题,类型
const MessageShow = (content, type = 'success') => {
  ElMessage({
    message: content,
    type: type,
    showClose: true,
  })
}
//操作确认类信息:操作类型,提示内容,提示标头,提示类型
const MessageConfirmShow = (czType, content, title = '操作确认提示', type = 'warning') => {
  ElMessageBox.confirm(
      content,
      title,
      {
        cancelButtonText: '取消',
        confirmButtonText: '确定',
        type: type,
        center: true,
      }
  )
      //点击了确定
      .then(() => {
        logicExecute(czType);
        return true;
      })
      //点击了取消
      .catch(() => {
        return false;
      })
}
//弹窗信息
const MessageAlertShow = (content, title, type = 'info') => {
  ElMessageBox.alert(content, title, {
    // 禁止自动对焦
    //autofocus: false,
    confirmButtonText: 'OK',
    /*callback: (action: Action) => {
      MessageShow(`action: ${action}`,type)
    },*/
  })
}
  ],
})
</script>
<template>
  <div>
     <el-button style="margin-top: 5px;margin-left: 5px;"   id="searchButton" type="primary" @click="showMessage">重新识别</el-button>
    <el-button style="margin-top: 5px"  id="searchButton" type="primary" @click="pick">人工匹配</el-button>
    <el-button style="margin-top: 5px"  id="searchButton" type="primary" @click="remove">人工拿走</el-button>
    <el-button style="margin-top: 5px"  id="searchButton" type="primary" >破损</el-button>
    <el-button style="margin-top: 5px"  id="searchButton" @click="boxb = true;box = false" >合并</el-button>
    <el-button style="margin-top: 5px"  id="searchButton" @click="box = true;boxb = false" >单片</el-button>
    <el-button style="margin-top: 5px;float: right;margin-right: 50px;"  id="searchButton" type="text"  @click="dialogForm">版图号</el-button>
    <div v-if="box">
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 450px;">
        <el-table height="100%" ref="table"
        @selection-change="handleSelectionChange"
        :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column type="selection" width="55"  />
          <el-table-column prop="id" align="center" label="id" min-width="80" />
          <el-table-column prop="long" align="center" label="长" min-width="120" />
          <el-table-column prop="wide" align="center" label="宽" min-width="120" />
          <el-table-column prop="type" align="center" label="状态" min-width="120" />
          <el-table-column prop="thick" align="center" label="其他" min-width="120" />
          <el-table-column fixed="right" label="操作" align="center" width="200">
            <template #default>
              <!-- <el-button size="mini" type="text" plain  @click="dialogFormVisible = true">详情</el-button> -->
              <el-button size="mini" type="text" plain  @click="dialogFormVisiblea = true">设置</el-button>
            </template>
        </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
    <div v-if="boxb">
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 450px;">
        <el-table height="100%" ref="table"
        @selection-change="handleSelectionChange"
        :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column type="selection" width="55"  />
          <el-table-column prop="id" align="center" label="类型序号" min-width="80" />
          <el-table-column prop="long" align="center" label="长" min-width="120" />
          <el-table-column prop="wide" align="center" label="宽" min-width="120" />
          <el-table-column prop="typea" align="center" label="数量" min-width="120" />
          <el-table-column prop="thick" align="center" label="其他" min-width="120" />
          <el-table-column fixed="right" label="操作" align="center" width="200">
            <template #default>
              <!-- <el-button size="mini" type="text" plain  @click="dialogFormVisible = true">详情</el-button> -->
              <el-button size="mini" type="text" plain  @click="dialogFormVisiblea = true">设置</el-button>
            </template>
        </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
    <!-- <div v-if="boxa">
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto">
        <el-table height="100%" ref="table"
        @selection-change="handleSelectionChange"
        :data="tableDataa" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column type="selection" width="55"  />
          <el-table-column prop="ida" align="center" label="id" min-width="80" />
          <el-table-column prop="longa" align="center" label="长" min-width="120" />
          <el-table-column prop="widea" align="center" label="宽" min-width="120" />
          <el-table-column prop="thicka" align="center" label="其他" min-width="120" />
        </el-table>
      </div>
    </el-card>
  </div> -->
  </div>
  <!-- <el-dialog v-model="dialogFormVisible" top="21vh" width="30%" title="小片图" >
        <div id="message">
          200*100
        </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button @click="dialogFormVisible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog> -->
  <el-dialog v-model="dialogFormVisiblea" top="21vh" width="30%" title="测量设置" >
            <el-form  size="mini" label-width="150px">
      <el-form style="margin-left: 80px;">
        <el-form-item label="误差长:" :required="true" style="width: 16vw;margin-bottom: 30px;">
            <div style="display: flex;"><el-input  autocomplete="off" /><div style="margin-left: 10px;">mm</div> </div>
              </el-form-item>
              <el-form-item label="误差宽:" :required="true" style="width: 16vw">
            <div style="display: flex;"><el-input  autocomplete="off" /><div style="margin-left: 10px;">mm</div> </div>
              </el-form-item>
        </el-form>
            </el-form>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="dialogFormVisiblea = false">
          确认
        </el-button>
        <el-button @click="dialogFormVisiblea = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
  <div id="awatch">小片图:
<div id="watch">200*100</div>
</div>
</template>
<style scoped>
:deep(.v-column-label div span) {
  font-weight: bold;
#dt { display:block; float:left;line-height: 20px;margin-left: 100px;}
#dta { display:block; float:left;line-height: 20px;margin-left: 80%;}
#dialog-footer{
  text-align: center;
  margin-top: -15px;
}
#message{
  text-align: center;
  align-items: center;
  color: black;
   width: 200px;
   height: 100px;
   background-color: #337ecc;
   margin-left: 28%;
}
#awatch{
  display: flex;
  margin-top: 20px;
  font-size: 20px;
  margin-left: 50px;
}
#watch{
  text-align: center;
  align-items: center;
  color: black;
   width: 300px;
   height: 150px;
   background-color: #337ecc;
   margin-left: 2%;
   margin-top: 10px;
}
</style>