Browse Source

物品基础信息前端 导入按钮

master
chenfang 1 year ago
parent
commit
597e37bd7a
  1. 4
      src/api/wms/itembasic/index.ts
  2. 8
      src/views/wms/itembasic/ItembasicDetail.vue
  3. 77
      src/views/wms/itembasic/index.vue

4
src/api/wms/itembasic/index.ts

@ -60,6 +60,8 @@ export const exportItembasic = async (params) => {
} }
// 下载用户导入模板 // 下载用户导入模板
export const importUserTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/itembasic/get-import-template' }) return request.download({ url: '/wms/itembasic/get-import-template' })
} }
// 导入地址
export const importUrl = '/wms/itembasic/import'

8
src/views/wms/itembasic/ItembasicDetail.vue

@ -41,8 +41,6 @@ import { ItemBasicTabsList } from '@/utils/disposition/tabsList.ts'
import { getItembasic } from '@/api/wms/itembasic' import { getItembasic } from '@/api/wms/itembasic'
const { query } = useRoute() // const { query } = useRoute() //
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import * as UserApi from '@/api/system/user'
const tabsList = ref(JSON.parse(JSON.stringify(ItemBasicTabsList))) const tabsList = ref(JSON.parse(JSON.stringify(ItemBasicTabsList)))
tabsList.value.unshift({ tabsList.value.unshift({
label: '详情', label: '详情',
@ -101,10 +99,10 @@ const changeRecordData = reactive({
time: '2023年5月6日 17:16:00', time: '2023年5月6日 17:16:00',
file: [{ file: [{
name: '这是个附件的名字.docx', name: '这是个附件的名字.docx',
url: 'http://localhost:12080/admin-api/system/user/get-import-template' url: 'http://localhost:12080//wms/itembasic/get-import-template'
}, { }, {
name: '这是个附件的名字.docx', name: '这是个附件的名字.docx',
url: 'http://localhost:12080/admin-api/system/user/get-import-template' url: 'http://localhost:12080/wms/itembasic/get-import-template'
}] }]
}] }]
}) })
@ -117,7 +115,7 @@ const importTemplateData = reactive({
onMounted(async () => { onMounted(async () => {
// //
detailData.value = await getItembasic(query.id) detailData.value = await getItembasic(query.id)
importTemplateData.templateUrl = await UserApi.importUserTemplate() importTemplateData.templateUrl = await ItembasicApi.importTemplate()
}) })
// //

77
src/views/wms/itembasic/index.vue

@ -2,9 +2,11 @@
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ItemBasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="ItemBasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
  <el-button type="primary" @click="openForm('create')">   <!-- 列表头部 -->
      <Icon icon="ep:plus" class="mr-5px" /> 新增 <TableHead
    </el-button> :HeadButttondata="HeadButttondata"
@buttonBaseClick="buttonBaseClick"
/>
<!-- <el-form <!-- <el-form
class="-mb-15px" class="-mb-15px"
@ -414,6 +416,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ItembasicForm ref="formRef" @success="getList" /> <ItembasicForm ref="formRef" @success="getList" />
<ImportForm ref="importFormRef" :url="ItembasicApi.importUrl" :importTemplateData="importTemplateData" @success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -421,9 +424,14 @@ import download from '@/utils/download'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import ItembasicForm from './ItembasicForm.vue' import ItembasicForm from './ItembasicForm.vue'
import ItembasicDetail from './ItembasicDetail.vue' import ItembasicDetail from './ItembasicDetail.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns' import { ItemBasic } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const router = useRouter() // const router = useRouter() //
console.log(ItembasicApi.importUrl);
// tableObject // tableObject
// tableMethods // tableMethods
// https://doc.iocoder.cn/vue3/crud-schema/ // https://doc.iocoder.cn/vue3/crud-schema/
@ -431,6 +439,24 @@ const { tableObject, tableMethods } = useTable({
getListApi: ItembasicApi.getItembasicPage // getListApi: ItembasicApi.getItembasicPage //
}) })
const importFormRef=ref()
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
// defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
@ -473,7 +499,52 @@ const queryParams = reactive({
}) })
const exportLoading = ref(false) // const exportLoading = ref(false) //
//
const buttonBaseClick = (val, item) => {
//
if (val == 'add') {
console.log(417, item)
}
//
else if (val == 'import') {
handleImport()
}
//
else if (val == 'export') {
handleExport()
}
//
else if (val == 'refresh') {
getList()
}
//
else if (val == 'filtrate') {
}
//
else {
}
}
onMounted(async () => {
importTemplateData.templateUrl = await ItembasicApi.importTemplate()
})
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '导入模版99.xls'
})
//
const importSuccess = () => {
getList()
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {

Loading…
Cancel
Save