| | |
| | | <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 { |
| | | DownOutlined, |
| | | UploadOutlined, |
| | | DownloadOutlined, |
| | | } from "@ant-design/icons-vue"; |
| | | |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/mat/export', {}).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; |
| | | }) |
| | |
| | | getPage(); |
| | | } |
| | | |
| | | const showTotalPage = (total, range) => { |
| | | return formatMessage('page.total.head', '总计') + total + formatMessage('page.total.footer', '条') |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | const matFieldList = ref(null); |
| | | MatFieldQuery(); |
| | | |
| | | function MatFieldQuery() { |
| | | post('/api/matField/list', {}).then(resp => { |
| | | let result = resp.data; |
| | |
| | | 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; |
| | | }) |
| | |
| | | |
| | | <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> |
| | | <template #overlay> |
| | | <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="{ |
| | | <a-upload v-model:file-list="fileList" name="file" action="/api/mat/upload" @change="handleUploadChange" |
| | | :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="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | |
| | | </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, 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', '编辑') }}</a-button> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ |
| | | formatMessage('page.edit', '编辑') |
| | | }} |
| | | </a-button> |
| | | <a-button type="link" danger @click="handleDel([record])"> |
| | | {{ formatMessage('page.delete', '删除') }} |
| | | </a-button> |