From a0f65b9cc2efbbbcfb1b2a7974a44b54ba937d04 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期六, 08 二月 2025 17:18:54 +0800
Subject: [PATCH] Merge branch '2.0.1' of http://139.186.142.91:10010/r/productDev/funingyunwei into 2.0.1
---
admin/src/views/stock/assetList.vue | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/admin/src/views/stock/assetList.vue b/admin/src/views/stock/assetList.vue
index 1b28a25..02bbe42 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,6 +96,39 @@
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) {
const { pagination, filters } = this
this.loading = true
--
Gitblit v1.9.3