陈薪名 1 year ago
parent
commit
b71bdf2399
  1. 5
      src/api/wms/itembasic/index.ts
  2. 8
      src/views/wms/itembasic/ItembasicImportForm.vue
  3. 199
      src/views/wms/itembasic/index.vue

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

@ -58,3 +58,8 @@ export const deleteItembasic = async (id: number) => {
export const exportItembasic = async (params) => { export const exportItembasic = async (params) => {
return await request.download({ url: `/wms/itembasic/export-excel`, params }) return await request.download({ url: `/wms/itembasic/export-excel`, params })
} }
// 下载用户导入模板
export const importUserTemplate = () => {
return request.download({ url: '/wms/itembasic/get-import-template' })
}

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

@ -41,11 +41,11 @@
</Dialog> </Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as UserApi from '@/api/system/user' import * as ItembasicApi from '@/api/wms/itembasic'
import { getAccessToken, getTenantId } from '@/utils/auth' import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download' import download from '@/utils/download'
defineOptions({ name: 'SystemUserImportForm' }) defineOptions({ name: 'WmsItembasicImportForm' })
const message = useMessage() // const message = useMessage() //
@ -53,7 +53,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // const formLoading = ref(false) //
const uploadRef = ref() const uploadRef = ref()
const importUrl = const importUrl =
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/import' import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/wms/itembasic/import'
const uploadHeaders = ref() // Header const uploadHeaders = ref() // Header
const fileList = ref([]) // const fileList = ref([]) //
const updateSupport = ref(0) // const updateSupport = ref(0) //
@ -127,7 +127,7 @@ const handleExceed = (): void => {
/** 下载模板操作 */ /** 下载模板操作 */
const importTemplate = async () => { const importTemplate = async () => {
const res = await UserApi.importUserTemplate() const res = await ItembasicApi.importUserTemplate()
download.excel(res, '物品基本信息导入模版.xls') download.excel(res, '物品基本信息导入模版.xls')
} }
</script> </script>

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

@ -1,8 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ItemBasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <el-form
<!-- <el-form
class="-mb-15px" class="-mb-15px"
:model="queryParams" :model="queryParams"
ref="queryFormRef" ref="queryFormRef"
@ -354,6 +353,12 @@
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
<el-button
type="warning"
@click="handleImport"
v-hasPermi="['wms:itembasic:import']">
<Icon icon="ep:upload" /> 导入
</el-button>
<el-button <el-button
type="success" type="success"
plain plain
@ -364,26 +369,128 @@
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> --> </el-form>
</ContentWrap> </ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
:columns="ItemBasic.allSchemas.tableColumns" <el-table-column label="代码" align="center" prop="code" width="150px" />
:data="tableObject.tableList" <el-table-column label="名称" align="center" prop="name" width="150px" />
:loading="tableObject.loading" <el-table-column label="描述1" align="center" prop="desc1" width="150px" />
:pagination="{ <el-table-column label="描述2" align="center" prop="desc2" width="150px" />
total: tableObject.total <el-table-column label="状态" align="center" prop="status" width="150px">
}" <template #default="scope">
v-model:pageSize="tableObject.pageSize" <dict-tag :type="DICT_TYPE.ITEM_STATUS" :value="scope.row.status" />
v-model:currentPage="tableObject.currentPage" </template>
> </el-table-column>
<template #action="{ row }"> <el-table-column label="计量单位" align="center" prop="uom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.UOM" :value="scope.row.uom" />
</template>
</el-table-column>
<el-table-column label="替代计量单位" align="center" prop="altUom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.UOM" :value="scope.row.altUom" />
</template>
</el-table-column>
<el-table-column label="是否标包" align="center" prop="isStdPack" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isStdPack" />
</template>
</el-table-column>
<el-table-column label="可采购" align="center" prop="enableBuy" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableBuy" />
</template>
</el-table-column>
<el-table-column label="可制造" align="center" prop="enableMake" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableMake" />
</template>
</el-table-column>
<el-table-column label="可委外加工" align="center" prop="enableOutsourcing" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableOutsourcing" />
</template>
</el-table-column>
<el-table-column label="回收件" align="center" prop="isRecycled" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isRecycled" />
</template>
</el-table-column>
<el-table-column label="虚零件" align="center" prop="isPhantom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isPhantom" />
</template>
</el-table-column>
<el-table-column label="ABC类" align="center" prop="abcClass" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ABC_CLASS" :value="scope.row.abcClass" />
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="type" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="种类" align="center" prop="category" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_CATEGORY" :value="scope.row.category" />
</template>
</el-table-column>
<el-table-column label="分组" align="center" prop="itemGroup" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_GROUP" :value="scope.row.itemGroup" />
</template>
</el-table-column>
<el-table-column label="颜色" align="center" prop="color" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_COLOR" :value="scope.row.color" />
</template>
</el-table-column>
<el-table-column label="配置" align="center" prop="configuration" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_CONFIGURATION" :value="scope.row.configuration" />
</template>
</el-table-column>
<el-table-column label="项目" align="center" prop="project" width="150px" />
<el-table-column label="质量等级" align="center" prop="eqLevel" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.EQ_LEVEL" :value="scope.row.eqLevel" />
</template>
</el-table-column>
<el-table-column label="有效天数" align="center" prop="validityDays" width="150px" />
<el-table-column label="是否可用" align="center" prop="available" width="150px" />
<el-table-column
label="生效时间"
align="center"
prop="activeTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column
label="失效时间"
align="center"
prop="expireTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="备注" align="center" prop="remark" width="150px" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="创建者ID" align="center" prop="creator" width="150px" />
<el-table-column label="操作" align="center" width="150px">
<template #default="scope">
<el-button <el-button
link link
type="primary" type="primary"
@click="openForm('update', row.id)" @click="openForm('update', scope.row.id)"
v-hasPermi="['wms:itembasic:update']" v-hasPermi="['wms:itembasic:update']"
> >
编辑 编辑
@ -391,40 +498,45 @@
<el-button <el-button
link link
type="danger" type="danger"
@click="handleDelete(row.id)" @click="handleDelete(scope.row.id)"
v-hasPermi="['wms:itembasic:delete']" v-hasPermi="['wms:itembasic:delete']"
> >
删除 删除
</el-button> </el-button>
</template> </template>
</Table> </el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ItembasicForm ref="formRef" @success="getList" /> <ItembasicForm ref="formRef" @success="getList" />
<!-- 用户导入对话框 -->
<ItembasicImportForm ref="importFormRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' 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 { ItemBasic } from '@/utils/disposition/tableColumns' import ItembasicImportForm from './ItembasicImportForm.vue'
// tableObject
// tableMethods
// https://doc.iocoder.cn/vue3/crud-schema/
const { tableObject, tableMethods } = useTable({
getListApi: ItembasicApi.getItembasicPage //
})
//
const { getList, setSearchParams } = tableMethods
defineOptions({ name: 'Itembasic' }) defineOptions({ name: 'Itembasic' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -457,8 +569,33 @@ const queryParams = reactive({
createTime: [], createTime: [],
creator: null creator: null
}) })
const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ItembasicApi.getItembasicPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
@ -466,6 +603,12 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
/** 用户导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
try { try {

Loading…
Cancel
Save