feat(psi): 添加仓库管理和仓库存储功能
- 新增仓库信息列表、添加、编辑、删除和详情功能 - 新增仓库存储列表、添加、编辑、删除和详情功能 - 实现仓库产品存储的查询、重置数量和强制校验功能 - 优化查询条件和表格展示
This commit is contained in:
parent
9616fab26e
commit
ca8a5257ac
26
src/api/psi/warehouse.ts
Normal file
26
src/api/psi/warehouse.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 仓库信息列表
|
||||
export function apiPsiWarehouseLists(params: any) {
|
||||
return request.get({ url: '/warehouse/warehouse/lists', params }, { urlPrefix: 'psi' })
|
||||
}
|
||||
|
||||
// 添加仓库信息
|
||||
export function apiPsiWarehouseAdd(params: any) {
|
||||
return request.post({ url: '/warehouse/warehouse/add', params }, { urlPrefix: 'psi' })
|
||||
}
|
||||
|
||||
// 编辑仓库信息
|
||||
export function apiPsiWarehouseEdit(params: any) {
|
||||
return request.post({ url: '/warehouse/warehouse/edit', params }, { urlPrefix: 'psi' })
|
||||
}
|
||||
|
||||
// 删除仓库信息
|
||||
export function apiPsiWarehouseDelete(params: any) {
|
||||
return request.post({ url: '/warehouse/warehouse/delete', params }, { urlPrefix: 'psi' })
|
||||
}
|
||||
|
||||
// 仓库信息详情
|
||||
export function apiPsiWarehouseDetail(params: any) {
|
||||
return request.get({ url: '/warehouse/warehouse/detail', params }, { urlPrefix: 'psi' })
|
||||
}
|
53
src/api/psi/warehouse_storege.ts
Normal file
53
src/api/psi/warehouse_storege.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 仓库存储列表
|
||||
export function apiPsiWarehouseStoregeLists(params: any) {
|
||||
return request.get(
|
||||
{ url: '/warehouse_storege/warehousestorege/lists', params },
|
||||
{ urlPrefix: 'psi' }
|
||||
)
|
||||
}
|
||||
|
||||
// 添加仓库存储
|
||||
export function apiPsiWarehouseStoregeAdd(params: any) {
|
||||
return request.post(
|
||||
{ url: '/warehouse_storege/warehousestorege/add', params },
|
||||
{ urlPrefix: 'psi' }
|
||||
)
|
||||
}
|
||||
|
||||
// 编辑仓库存储
|
||||
export function apiPsiWarehouseStoregeEdit(params: any) {
|
||||
return request.post(
|
||||
{ url: '/warehouse_storege/warehousestorege/edit', params },
|
||||
{ urlPrefix: 'psi' }
|
||||
)
|
||||
}
|
||||
|
||||
// 删除仓库存储
|
||||
export function apiPsiWarehouseStoregeDelete(params: any) {
|
||||
return request.post(
|
||||
{ url: '/warehouse_storege/warehousestorege/delete', params },
|
||||
{ urlPrefix: 'psi' }
|
||||
)
|
||||
}
|
||||
|
||||
// 仓库存储详情
|
||||
export function apiPsiWarehouseStoregeDetail(params: any) {
|
||||
return request.get(
|
||||
{ url: '/warehouse_storege/warehousestorege/detail', params },
|
||||
{ urlPrefix: 'psi' }
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 是否强制校验
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export function apiPsiWarehouseProductStoregeVerify(params: any) {
|
||||
return request.post({
|
||||
url: '/warehouse_storege/warehousestorege/verify',
|
||||
params
|
||||
},
|
||||
{ urlPrefix: 'psi' })
|
||||
}
|
103
src/views/psi/warehouse/details.vue
Normal file
103
src/views/psi/warehouse/details.vue
Normal file
@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
title="详情"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:cancelButtonText="false"
|
||||
:confirmButtonText="false"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px">
|
||||
<el-form-item label="仓库名称" prop="name">
|
||||
<el-input v-model="formData.name" clearable placeholder="请输入仓库名称" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人员" prop="contacts">
|
||||
<el-input v-model="formData.contacts" clearable placeholder="请输入联系人员" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="tel">
|
||||
<el-input v-model="formData.tel" clearable placeholder="请输入联系电话" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库地址" prop="address">
|
||||
<el-input v-model="formData.address" clearable placeholder="请输入仓库地址" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息" prop="notes">
|
||||
<el-input v-model="formData.notes" clearable placeholder="请输入备注信息" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="formData.sort" clearable placeholder="请输入排序" :readonly="true"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="psiWarehouseDETAILS">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiPsiWarehouseAdd, apiPsiWarehouseEdit, apiPsiWarehouseDetail } from '@/api/psi_warehouse'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
contacts: '',
|
||||
tel: '',
|
||||
address: '',
|
||||
notes: '',
|
||||
sort: '',
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiPsiWarehouseDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = () => {
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
160
src/views/psi/warehouse/edit.vue
Normal file
160
src/views/psi/warehouse/edit.vue
Normal file
@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="仓库名称" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
clearable
|
||||
placeholder="请输入仓库名称"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库编号" prop="code">
|
||||
<el-input
|
||||
v-model="formData.code"
|
||||
clearable
|
||||
placeholder="请输入仓库编号"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人员" prop="contacts">
|
||||
<el-input
|
||||
v-model="formData.contacts"
|
||||
clearable
|
||||
placeholder="请输入联系人员"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="tel">
|
||||
<el-input
|
||||
v-model="formData.tel"
|
||||
clearable
|
||||
placeholder="请输入联系电话"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库地址" prop="address">
|
||||
<el-input
|
||||
v-model="formData.address"
|
||||
clearable
|
||||
placeholder="请输入仓库地址"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息" prop="notes">
|
||||
<el-input
|
||||
v-model="formData.notes"
|
||||
clearable
|
||||
placeholder="请输入备注信息"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input
|
||||
v-model="formData.sort"
|
||||
clearable
|
||||
placeholder="请输入排序"
|
||||
:readonly="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="warehouseEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiPsiWarehouseAdd, apiPsiWarehouseEdit, apiPsiWarehouseDetail } from '@/api/psi/warehouse'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑仓库信息' : '新增仓库信息'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
contacts: '',
|
||||
tel: '',
|
||||
address: '',
|
||||
notes: '',
|
||||
sort: ''
|
||||
})
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入仓库名称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiPsiWarehouseDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData }
|
||||
mode.value == 'edit' ? await apiPsiWarehouseEdit(data) : await apiPsiWarehouseAdd(data)
|
||||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
159
src/views/psi/warehouse/index.vue
Normal file
159
src/views/psi/warehouse/index.vue
Normal file
@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="仓库名称" prop="name">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.name"
|
||||
clearable
|
||||
placeholder="请输入仓库名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人员" prop="contacts">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.contacts"
|
||||
clearable
|
||||
placeholder="请输入联系人员"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="tel">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.tel"
|
||||
clearable
|
||||
placeholder="请输入联系电话"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button v-perms="['admin.warehouse/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['admin.warehouse/delete']"
|
||||
:disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="仓库名称" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<router-link
|
||||
:to="{
|
||||
path: 'warehouse_storege',
|
||||
query: { id: row.id }
|
||||
}"
|
||||
class="ml-4 text-success"
|
||||
>
|
||||
{{ row.name }}
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库编号" prop="code" show-overflow-tooltip />
|
||||
<el-table-column label="联系人员" prop="contacts" show-overflow-tooltip />
|
||||
<el-table-column label="联系电话" prop="tel" show-overflow-tooltip />
|
||||
<el-table-column label="仓库地址" prop="address" show-overflow-tooltip />
|
||||
<el-table-column label="备注信息" prop="notes" show-overflow-tooltip />
|
||||
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['admin.warehouse/delete']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
:dict-data="dictData"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="warehouseLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiPsiWarehouseLists, apiPsiWarehouseDelete } from '@/api/psi/warehouse'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
name: '',
|
||||
contacts: '',
|
||||
tel: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiPsiWarehouseLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.setFormData(data)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (id: number | any[]) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await apiPsiWarehouseDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
99
src/views/psi/warehouse_storege/details.vue
Normal file
99
src/views/psi/warehouse_storege/details.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
title="详情"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:cancelButtonText="false"
|
||||
:confirmButtonText="false"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px">
|
||||
<el-form-item label="仓库ID" prop="warehouse_id">
|
||||
<el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库ID" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品ID" prop="product_id">
|
||||
<el-input v-model="formData.product_id" clearable placeholder="请输入商品ID" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="0不校验1校验" prop="is_verify">
|
||||
<el-input v-model="formData.is_verify" clearable placeholder="请输入0不校验1校验" :readonly="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="formData.price" clearable placeholder="请输入价格" :readonly="true"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="psiWarehouseStoregeDETAILS">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiPsiWarehouseStoregeAdd, apiPsiWarehouseStoregeEdit, apiPsiWarehouseStoregeDetail } from '@/api/psi_warehouse_storege'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
warehouse_id: '',
|
||||
product_id: '',
|
||||
nums: '',
|
||||
is_verify: '',
|
||||
price: '',
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiPsiWarehouseStoregeDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = () => {
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
140
src/views/psi/warehouse_storege/edit.vue
Normal file
140
src/views/psi/warehouse_storege/edit.vue
Normal file
@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="仓库ID" prop="warehouse_id">
|
||||
<el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库ID" :readonly="false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品ID" prop="product_id">
|
||||
<el-input v-model="formData.product_id" clearable placeholder="请输入商品ID" :readonly="false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="0不校验1校验" prop="is_verify">
|
||||
<el-input v-model="formData.is_verify" clearable placeholder="请输入0不校验1校验" :readonly="false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="formData.price" clearable placeholder="请输入价格" :readonly="false"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="psiWarehouseStoregeEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiPsiWarehouseStoregeAdd, apiPsiWarehouseStoregeEdit, apiPsiWarehouseStoregeDetail } from '@/api/psi_warehouse_storege'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑仓库存储' : '新增仓库存储'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
warehouse_id: '',
|
||||
product_id: '',
|
||||
nums: '',
|
||||
is_verify: '',
|
||||
price: '',
|
||||
})
|
||||
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
warehouse_id: [{
|
||||
required: true,
|
||||
message: '请输入仓库ID',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
product_id: [{
|
||||
required: true,
|
||||
message: '请输入商品ID',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
nums: [{
|
||||
required: true,
|
||||
message: '请输入数量',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
price: [{
|
||||
required: true,
|
||||
message: '请输入价格',
|
||||
trigger: ['blur']
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiPsiWarehouseStoregeDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData, }
|
||||
mode.value == 'edit'
|
||||
? await apiPsiWarehouseStoregeEdit(data)
|
||||
: await apiPsiWarehouseStoregeAdd(data)
|
||||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
332
src/views/psi/warehouse_storege/index.vue
Normal file
332
src/views/psi/warehouse_storege/index.vue
Normal file
@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
@keydown.enter="resetPage"
|
||||
v-model="queryParams.store_name"
|
||||
clearable
|
||||
placeholder="请输入商品名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="商品分类" prop="store_name">
|
||||
<el-cascader
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.class_all"
|
||||
filterable
|
||||
clearable
|
||||
:before-filter="beforeFilter"
|
||||
:props="props"
|
||||
placeholder="请选择商品分类"
|
||||
@change="resetPage"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="商品条码" prop="bar_code">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.bar_code"
|
||||
clearable
|
||||
placeholder="请输入商品条码"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="排序" prop="order_by">
|
||||
<el-select
|
||||
v-model="queryParams.order_by"
|
||||
placeholder="请选择排序"
|
||||
style="width: 240px"
|
||||
@change="resetPage"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in [
|
||||
{ id: 'asc', name: '升序' },
|
||||
{ id: 'desc', name: '降序' }
|
||||
]"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
<export-data
|
||||
class="ml-2.5"
|
||||
:fetch-fun="apiWarehouseProductStoregeLists"
|
||||
:params="queryParams"
|
||||
:page-size="pager.size"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<router-link
|
||||
:to="{
|
||||
path: 'import',
|
||||
query: { warehouse_id: queryParams.warehouse_id }
|
||||
}"
|
||||
class="ml-4"
|
||||
>
|
||||
<el-button type="primary"> 出库 </el-button>
|
||||
</router-link>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="商品图片" prop="image" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
style="width: 50px; height: 50px"
|
||||
:src="row.image"
|
||||
:preview-teleported="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="商品名称"
|
||||
prop="store_name"
|
||||
min-width="200"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="分类"
|
||||
prop="cate_name"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="单位"
|
||||
prop="unit_name"
|
||||
min-width="80"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="价格" prop="price" min-width="80" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<p>商户价{{ row.cost }}</p>
|
||||
<p>供货价{{ row.purchase }}</p>
|
||||
<p>零售{{ row.price }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="规格"
|
||||
prop="store_info"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="毛利率"
|
||||
prop="rose"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="库存"
|
||||
prop="nums"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="价值"
|
||||
prop="total_price"
|
||||
min-width="200"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="强制校验" prop="is_verify">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
size="large"
|
||||
@change="verifyChange(row)"
|
||||
v-model="row.is_verify"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="校验"
|
||||
inactive-text="不校验"
|
||||
inline-prompt
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
@click="resetProductStoregeClick(row)"
|
||||
v-perms="[
|
||||
'warehouse_product_storege.warehouse_product_storege/edit'
|
||||
]"
|
||||
>
|
||||
重置数量
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- <Details ref="detailsRef"></Details> -->
|
||||
</div>
|
||||
<el-dialog v-model="resetProductStoregeShow" title="重置数量" width="600">
|
||||
<el-form :model="formData" label-width="90px">
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input v-model="formData.store_name" clearable :readonly="false" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input
|
||||
v-model="formData.nums"
|
||||
clearable
|
||||
:readonly="false"
|
||||
placeholder="请输入数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
clearable
|
||||
:readonly="false"
|
||||
placeholder="请输入数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="resetProductStoregeShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="resetProductStorege"> 确认 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="storeProductLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import {
|
||||
apiPsiWarehouseStoregeLists,
|
||||
apiPsiWarehouseStoregeEdit,
|
||||
apiPsiWarehouseProductStoregeVerify
|
||||
} from '@/api/psi/warehouse_storege'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
// import Details from './details.vue'
|
||||
// import { apiStoreCategoryLists } from '@/api/store_category'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const resetProductStoregeShow = ref(false)
|
||||
const formData = ref({
|
||||
id: '',
|
||||
store_name: '',
|
||||
nums: '',
|
||||
remark: ''
|
||||
})
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
store_name: '',
|
||||
class_all: '',
|
||||
warehouse_id: '',
|
||||
bar_code: '',
|
||||
order_by: '',
|
||||
field: 'nums'
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
// 分页相关
|
||||
let page_no = 1
|
||||
if (route.query.page_no) {
|
||||
page_no = parseInt(route.query.page_no)
|
||||
}
|
||||
if (route.query.id) {
|
||||
queryParams.warehouse_id = parseInt(route.query.id)
|
||||
}
|
||||
console.log(route.query.id)
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
page: page_no,
|
||||
fetchFun: apiPsiWarehouseStoregeLists,
|
||||
params: queryParams
|
||||
})
|
||||
const resetProductStoregeClick = (data: any) => {
|
||||
resetProductStoregeShow.value = true
|
||||
formData.value.id = data.id
|
||||
formData.value.store_name = data.store_name
|
||||
formData.value.nums = data.nums
|
||||
}
|
||||
const resetProductStorege = (data: any) => {
|
||||
resetProductStoregeShow.value = false
|
||||
if (formData.value.id <= 0) {
|
||||
ElMessage.error('id不能为空')
|
||||
return false
|
||||
}
|
||||
apiPsiWarehouseStoregeEdit(formData.value).then((res) => {
|
||||
getLists()
|
||||
})
|
||||
}
|
||||
|
||||
let resolves
|
||||
let nodes
|
||||
const flag = ref(false)
|
||||
let name
|
||||
// const beforeFilter = (value) => {
|
||||
// name = value
|
||||
// flag.value = true
|
||||
// props.lazyLoad(nodes, resolves)
|
||||
// return false
|
||||
// }
|
||||
// const props = {
|
||||
// value: 'id',
|
||||
// label: 'name',
|
||||
// emitPath: false,
|
||||
// lazy: true,
|
||||
// lazyLoad(node, resolve) {
|
||||
// if (!resolves) resolves = resolve
|
||||
// if (!nodes) nodes = node
|
||||
// const pid = node.value || 0
|
||||
// let data = {}
|
||||
// if (flag.value) {
|
||||
// data = { name: name }
|
||||
// if (!name) {
|
||||
// data = {
|
||||
// pid: pid,
|
||||
// page_size: 10000
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// data = {
|
||||
// pid: pid,
|
||||
// page_size: 10000
|
||||
// }
|
||||
// }
|
||||
// apiStoreCategoryLists({
|
||||
// ...data
|
||||
// }).then((res) => {
|
||||
// resolve(
|
||||
// res.lists.map((item: any) => {
|
||||
// // item.leaf = item.is_children == 0;
|
||||
// item.leaf = true
|
||||
// flag.value = false
|
||||
// return item
|
||||
// })
|
||||
// )
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
const verifyChange = (row: any) => {
|
||||
apiPsiWarehouseProductStoregeVerify({
|
||||
id: row.id,
|
||||
is_verify: row.is_verify
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getLists()
|
||||
})
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user