#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-admin/src/views/base/mat/index.vue
@@ -1,11 +1,11 @@
<script setup>
import {getCurrentInstance, ref, computed, reactive} from 'vue';
import {useRouter} from "vue-router";
import {get, post, postBlob, postForm} from '@/utils/request.js'
import {message, Modal} from 'ant-design-vue';
import {globalState, logout} from '@/config.js';
import { getCurrentInstance, ref, computed, reactive } from 'vue';
import { useRouter } from "vue-router";
import { get, post, postBlob, postForm } from '@/utils/request.js'
import { message, Modal } from 'ant-design-vue';
import { globalState, logout } from '@/config.js';
import EditView from './edit.vue'
import {formatMessage} from '@/utils/localeUtils.js';
import { formatMessage } from '@/utils/localeUtils.js';
import useTableSearch from '@/utils/tableUtils.jsx';
import MatPrint from '@/components/print/matPrint/index.vue';
import {
@@ -414,8 +414,11 @@
}
const handleExport = async (intl) => {
  postBlob('/api/mat/export', {}).then(result => {
    const blob = new Blob([result.data], {type: 'application/vnd.ms-excel'});
  postBlob('/api/mat/export', {
    condition: searchInput.value,
    _param: searchParam.value,
  }).then(result => {
    const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
    window.location.href = window.URL.createObjectURL(blob);
    return true;
  })
@@ -465,7 +468,7 @@
const exportTemplate = () => {
  //模板导出
  postBlob('/api/mat/exportTemplate', {}).then(result => {
    const blob = new Blob([result.data], {type: 'application/vnd.ms-excel'});
    const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
    window.location.href = window.URL.createObjectURL(blob);
    return true;
  })
@@ -490,20 +493,20 @@
};
const handlePrint = () => {
    if (state.selectedRowKeys.length == 0) {
        message.warning(formatMessage('common.select', '请选择'));
        return;
  if (state.selectedRowKeys.length == 0) {
    message.warning(formatMessage('common.select', '请选择'));
    return;
  }
  let data = tableData.value.records;
  let tmp = [];
  data.forEach((item) => {
    if (state.selectedRowKeys.indexOf(item.id) != -1) {
      tmp.push(item);
    }
    let data = tableData.value.records;
    let tmp = [];
    data.forEach((item) => {
        if (state.selectedRowKeys.indexOf(item.id) != -1) {
            tmp.push(item);
        }
    })
  })
    printChild.value.printData = tmp;
    printChild.value.open = true;
  printChild.value.printData = tmp;
  printChild.value.open = true;
}
</script>
@@ -516,22 +519,20 @@
<template>
  <div>
    <EditView ref="editChild" @tableReload="handleTableReload"/>
    <EditView ref="editChild" @tableReload="handleTableReload" />
    <div class="table-header">
      <div>
        <a-input v-model:value="searchParam.matnr"
                 :placeholder="formatMessage('page.mat.matnr.input', '请输入商品编号')"
                 style="width: 140px;margin-right: 10px;"/>
        <a-input v-model:value="searchParam.maktx"
                 :placeholder="formatMessage('page.mat.matnr.input', '请输入商品名称')"
                 style="width: 140px;margin-right: 10px;"/>
        <a-input v-model:value="searchParam.matnr" :placeholder="formatMessage('page.mat.matnr.input', '请输入商品编号')"
          style="width: 140px;margin-right: 10px;" />
        <a-input v-model:value="searchParam.maktx" :placeholder="formatMessage('page.mat.matnr.input', '请输入商品名称')"
          style="width: 140px;margin-right: 10px;" />
        <a-input v-model:value="searchParam.specs" :placeholder="formatMessage('page.mat.matnr.input', '请输入规格')"
                 style="width: 140px;margin-right: 10px;"/>
          style="width: 140px;margin-right: 10px;" />
        <a-input v-model:value="searchParam.model" :placeholder="formatMessage('page.mat.matnr.input', '请输入型号')"
                 style="width: 140px;margin-right: 10px;"/>
          style="width: 140px;margin-right: 10px;" />
        <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')"
                        style="width: 200px;" @search="onSearch"/>
          style="width: 200px;" @search="onSearch" />
      </div>
      <div class="table-header-right">
        <a-dropdown>
@@ -539,23 +540,23 @@
            <a-menu @click="handleSyncMatClick">
              <a-menu-item key="import">
                <a-upload v-model:file-list="fileList" name="file" action="/api/mat/upload" @change="handleUploadChange"
                          :showUploadList="false" :headers="{
                  :showUploadList="false" :headers="{
                    Authorization: globalState.token
                  }">
                  <UploadOutlined/>
                  <UploadOutlined />
                  {{ formatMessage('page.mat.import', '商品导入') }}
                </a-upload>
              </a-menu-item>
              <a-menu-item key="export">
                <DownloadOutlined/>
                <DownloadOutlined />
                {{ formatMessage('page.mat.export.template', '导出模板') }}
              </a-menu-item>
            </a-menu>
          </template>
          <a-button>
            {{ formatMessage('page.mat.sync', '数据同步') }}
            <DownOutlined/>
            <DownOutlined />
          </a-button>
        </a-dropdown>
        <a-button @click="handlePrint()" type="primary">
@@ -566,17 +567,16 @@
      </div>
    </div>
    <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
             :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
             :pagination="{ total: tableData.total, showTotal: showTotalPage, onChange: onPageChange }"
             :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns"
             @resizeColumn="handleResizeColumn"
             :loading="state.loading">
      :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
      :pagination="{ total: tableData.total, showTotal: showTotalPage, onChange: onPageChange }"
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" @resizeColumn="handleResizeColumn"
      :loading="state.loading">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'oper'">
          <div style="display: flex;justify-content: space-evenly;">
            <a-button type="link" primary @click="handleEdit(record)">{{
                formatMessage('page.edit', '编辑')
              }}
              formatMessage('page.edit', '编辑')
            }}
            </a-button>
            <a-button type="link" danger @click="handleDel([record])">
              {{ formatMessage('page.delete', '删除') }}