廖井涛
6 天以前 a660db06773007b1be690e0674829c00a57aeb7b
north-glass-erp/northglass-erp/src/views/pp/productionBasicData/AddBreakageReason.vue
@@ -7,11 +7,17 @@
import {changeFilterEvent, filterChanged} from "@/hook"
import userInfo from "@/stores/userInfo"
import {useI18n} from 'vue-i18n'
import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
//语言获取
const {t} = useI18n()
const route = useRoute()
const user = userInfo()
let router = useRouter()
onMounted(() => {
  //启用表格拖动选中
  addListener(xGrid.value, gridOptions)
})
//子组件接收参数
const xGrid = ref()
@@ -44,10 +50,10 @@
    showStatus: true
  },//表头参数
  columns:[
    { type: 'seq',fixed:"left", title: '自序', width: 50 },
    { type: 'seq',fixed:"left", title: t('basicData.Number'), width: 50 },
    {
      field: 'basicName',
      title: '次破原因',
      title: t('reportingWorks.breakageReason'),
      width: 1000,
      editRender: {name: 'input', attrs: {placeholder: ''}},
@@ -56,8 +62,9 @@
  //表头按钮
  toolbarConfig: {
    buttons: [
      {code: 'save', name: '保存', status: 'primary', icon: 'vxe-icon-save'},
      {code: 'removeRow', name: t('basicData.delete'), status: 'primary', icon: 'vxe-icon-delete'},
      {code: 'addRow', name: t('reportingWorks.increase'), status: 'primary', icon: 'vxe-icon-square-plus'},
      {code: 'save', name: t('basicData.save'), status: 'primary', icon: 'vxe-icon-save'},
    ],
    // import: false,
    // export: true,
@@ -74,7 +81,7 @@
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
          return t('basicData.total')
        }
        if (footList.includes(column.field)) {
          return sumNum(data, column.field)
@@ -94,6 +101,13 @@
          $grid.insertAt({})
          break
        }
        case 'removeRow': {
          let result = toolbarButtonClickEvent()
          if (result) {
            $grid.remove(result.row)
          }
          break
        }
        case 'save': {
          const tableData = $grid.getTableData().fullData
          //console.log(tableData)
@@ -102,7 +116,7 @@
          })
          request.post("/basicDataProduce/saveBreakageReason", breakageTypeData.value).then((res) => {
            if (res.code == 200) {
              ElMessage.success("保存成功")
              ElMessage.success(t('basicData.msg.saveSuccess'))
              router.push({
                path: '/main/productionBasicData/AddBreakageReason',
                query: {random: Math.random()}
@@ -127,40 +141,42 @@
</script>
<template>
  <div class="main-div-customer">
    <vxe-grid
        ref="xGrid"
        class="mytable-scrollbar"
        max-height="100%"
        height="650px"
        v-bind="gridOptions"
        v-on="teamGridEvents"
        @filter-change="filterChanged"
  <div  style="width: 100%;height: 100%">
    <div class="main-table">
      <vxe-grid
          ref="xGrid"
          class="mytable-scrollbar"
          height="100%"
          v-bind="gridOptions"
          v-on="teamGridEvents"
          @filter-change="filterChanged"
    >
      <!--      @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>
      >
        <!--      @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 #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)"/>
        <template #num1_filter="{ column, $panel }">
          <div>
            <div v-for="(option, index) in column.filters" :key="index">
              <input type="type" v-model="option.data"
                     @keyup.enter.native="$panel.confirmFilter()"
                     @input="changeFilterEvent($event, option, $panel)"/>
            </div>
          </div>
        </div>
      </template>
        </template>
    </vxe-grid>
      </vxe-grid>
    </div>
  </div>
</template>
@@ -170,4 +186,21 @@
  margin:  0 auto;
  height: 100%;
}
.head{
  width: 100%;
  height: 35px;
}
.main-table{
  width: 100%;
  height: calc(100% - 0px);
}
.vxe-grid {
  /* 禁用浏览器默认选中 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
</style>