From c5109dd484be07f6c49a3c4c4df7ae79b89f4fb0 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 六月 2025 19:18:57 +0800
Subject: [PATCH] 开发更新
---
admin/src/views/stock/assetList.vue | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/admin/src/views/stock/assetList.vue b/admin/src/views/stock/assetList.vue
index 1b28a25..7e4042c 100644
--- a/admin/src/views/stock/assetList.vue
+++ b/admin/src/views/stock/assetList.vue
@@ -3,12 +3,20 @@
<QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
<div class="mt20">
<el-button type="primary" @click="$refs.newMaterial.open('鏂板缓鐗╂枡')">娣诲姞</el-button>
- <el-button>瀵煎嚭</el-button>
- <el-button>瀵煎叆</el-button>
+ <el-button @click="exportExcel">瀵煎嚭</el-button>
+ <el-popover
+ placement="right"
+ trigger="click">
+ <div style="display: flex; align-items: center; justify-content: center;">
+ <el-button type="primary" @click="$refs.uploadFile.click()">瀵煎叆妯℃澘</el-button>
+ <el-button type="text" @click="exportTemplate">鐐瑰嚮涓嬭浇妯$増.EXCEL</el-button>
+ </div>
+ <el-button style="margin-left: 10px;" slot="reference">瀵煎叆</el-button>
+ </el-popover>
</div>
<el-table v-loading="loading" :data="list" stripe>
- <el-table-column prop="code" label="璧勪骇缂栫爜" min-width="100" show-overflow-tooltip />
- <el-table-column prop="name" label="璧勪骇鍚嶇О" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="code" label="鐗╂枡缂栫爜" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="name" label="鐗╂枡鍚嶇О" min-width="100" show-overflow-tooltip />
<el-table-column prop="qrcode" label="鏉$爜" min-width="100" show-overflow-tooltip />
<el-table-column prop="brand" label="鍝佺墝" min-width="100" show-overflow-tooltip />
<el-table-column prop="attr" label="瑙勬牸鍨嬪彿" min-width="100" show-overflow-tooltip />
@@ -38,6 +46,7 @@
<Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
</div>
<newMaterial ref="newMaterial" @success="getList" />
+ <input type="file" ref="uploadFile" @change="importTemplate" accept=".xlsx" style="position: fixed; top: -100px;" />
</div>
</template>
@@ -48,7 +57,7 @@
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)
-import { fetchList, updateStatus, deleteById } from '@/api/ywMaterial'
+import { fetchList, updateStatus, deleteById, exportExcel, importMaterialBatch } from '@/api/ywMaterial'
export default {
components: {
Pagination,
@@ -87,7 +96,43 @@
this.getList()
},
methods: {
+ // 瀵煎嚭妯℃澘
+ exportTemplate () {
+ window.open('/template/material.xlsx')
+ },
+ // 瀵煎叆妯℃澘
+ importTemplate(e) {
+ const FormDate = new FormData()
+ FormDate.append('file', e.target.files[0])
+ importMaterialBatch(FormDate)
+ .then(res => {
+ this.getList()
+ })
+ .finally(() => {
+ this.$refs.uploadFile.value = null
+ })
+ },
+ exportExcel () {
+ this.$dialog.exportConfirm('纭瀵煎嚭鍚楋紵')
+ .then(() => {
+ exportExcel({
+ page: this.pagination.page,
+ capacity: 1000000,
+ model: this.filters
+ })
+ .then(response => {
+ this.download(response)
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ })
+ .catch(() => {})
+ },
getList(page) {
+ if (page) {
+ this.pagination.page = page
+ }
const { pagination, filters } = this
this.loading = true
fetchList({
--
Gitblit v1.9.3