商城联调
This commit is contained in:
40
src/api/mall/warehouse/index.js
Normal file
40
src/api/mall/warehouse/index.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import request from '@/config/axios'
|
||||
// 查询列表
|
||||
export const getWarehousePage = async (params) => {
|
||||
return await request.get({ url: '/admin-api/crm/erp-warehouse/page', params })
|
||||
}
|
||||
|
||||
// 新增
|
||||
export const createWarehouse = async (data) => {
|
||||
return await request.post({ url: '/admin-api/crm/erp-warehouse/create', data: data })
|
||||
}
|
||||
|
||||
// 修改
|
||||
export const updateWarehouse = async (params) => {
|
||||
return await request.put({ url: '/admin-api/crm/erp-warehouse/update', data: params })
|
||||
}
|
||||
|
||||
// 删除
|
||||
export const deleteWarehouse = async (id) => {
|
||||
return await request.delete({ url: '/admin-api/crm/erp-warehouse/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 获取仓库
|
||||
export const getWarehouse = async (id) => {
|
||||
return await request.get({ url: '/admin-api/crm/erp-warehouse/get?id=' + id })
|
||||
}
|
||||
|
||||
// 获取仓库列表
|
||||
export const getSimpleWarehouseList = async () => {
|
||||
return await request.get({ url: '/admin-api/crm/erp-warehouse/simple-list' })
|
||||
}
|
||||
|
||||
// 获取库存
|
||||
export const getInventoryList = async (params) => {
|
||||
return await request.get({ url: '/admin-api/crm/erp-inventory/page', params })
|
||||
}
|
||||
|
||||
// 获取库存变动记录
|
||||
export const getInventoryRecord = async (params) => {
|
||||
return await request.get({ url: '/admin-api/crm/erp-inventory-record/page', params })
|
||||
}
|
||||
103
src/views/MiniMall/Inventory/Comp/DialogWarehouse.vue
Normal file
103
src/views/MiniMall/Inventory/Comp/DialogWarehouse.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="formData.warehouseName" placeholder="请输入仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="formData.sort" placeholder="请输入排序" type="number" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogWarehouse" setup>
|
||||
import * as WarehouseApi from '@/api/mall/warehouse'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
name: '',
|
||||
sort: 1,
|
||||
remark: ''
|
||||
})
|
||||
const formRules = reactive({
|
||||
warehouseName: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type, id) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type == 'update' ? '修改仓库' : '新增仓库'
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WarehouseApi.getWarehouse(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef.value) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
if (formType.value === 'create') {
|
||||
await WarehouseApi.createWarehouse(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WarehouseApi.updateWarehouse(formData.value)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
name: '',
|
||||
sort: 1,
|
||||
remark: ''
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
@@ -1,37 +1,18 @@
|
||||
// import { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||||
|
||||
// CrudSchema:https://doc.iocoder.cn/vue3/crud-schema/
|
||||
const crudSchemas = reactive([
|
||||
{
|
||||
label: '产品名称',
|
||||
field: 'name',
|
||||
isSearch: true,
|
||||
field: 'productName',
|
||||
isTable: true
|
||||
},
|
||||
{
|
||||
label: '规格名称',
|
||||
field: 'specsName',
|
||||
isSearch: true,
|
||||
isTable: true
|
||||
},
|
||||
{
|
||||
label: '仓库',
|
||||
field: 'warehouse',
|
||||
isSearch: true,
|
||||
isTable: true,
|
||||
search: {
|
||||
component: 'Select',
|
||||
api: () => [
|
||||
{ label: '自营仓', value: 1 },
|
||||
{ label: '供应商仓', value: 2 }
|
||||
],
|
||||
componentProps: {
|
||||
optionsAlias: {
|
||||
labelField: 'label',
|
||||
valueField: 'value'
|
||||
}
|
||||
}
|
||||
}
|
||||
field: 'warehouseName',
|
||||
isTable: true
|
||||
}
|
||||
])
|
||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
||||
|
||||
@@ -1,21 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<Search
|
||||
:schema="allSchemas.searchSchema"
|
||||
labelWidth="0"
|
||||
expand
|
||||
expand-field="name"
|
||||
@search="setSearchParams"
|
||||
@reset="setSearchParams"
|
||||
/>
|
||||
<!-- 列表 -->
|
||||
<SSTable
|
||||
class="mt-20px"
|
||||
v-model:tableObject="tableObject"
|
||||
:tableColumns="allSchemas.tableColumns"
|
||||
@get-list="getTableList"
|
||||
<el-form inline :model="searchForm" class="-mb-15px" label-width="0">
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.productId"
|
||||
placeholder="选择产品"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeProd"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in opts.product"
|
||||
:key="item.productId"
|
||||
:label="item.productName"
|
||||
:value="item.productId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.specsId"
|
||||
placeholder="选择规格"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!searchForm.productId"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in opts.spec"
|
||||
:key="item.specsId"
|
||||
:label="item.specsName"
|
||||
:value="item.specsId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searchForm.warehouseId" placeholder="仓库" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in opts.warehouse"
|
||||
:key="item.warehouseId"
|
||||
:label="item.warehouseName"
|
||||
:value="item.warehouseId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleSearch"> 搜索 </el-button>
|
||||
<el-button @click="resetQuery"> 重置 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" class="mt-20px" :data="tableList" border>
|
||||
<el-table-column
|
||||
v-for="item in allSchemas.tableColumns"
|
||||
:key="item.table?.field || item.field"
|
||||
@@ -25,36 +60,89 @@
|
||||
min-width="150px"
|
||||
showOverflowTooltip
|
||||
/>
|
||||
<el-table-column prop="count" label="库存数量">
|
||||
<!-- <template #default="{ row }">
|
||||
<el-button v-if="row.count" type="primary" text @click="handleDetail">{{
|
||||
row.count
|
||||
}}</el-button>
|
||||
<span v-else>{{ row.count }}</span>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</SSTable>
|
||||
<el-table-column prop="num" label="库存数量" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="searchForm.pageSize"
|
||||
v-model:page="searchForm.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup name="InventoryDetail">
|
||||
import { allSchemas } from './InventoryDetail.data.js'
|
||||
import { getSimpleWarehouseList, getInventoryList } from '@/api/mall/warehouse'
|
||||
import { getSimpleProductList } from '@/api/mall/product'
|
||||
|
||||
const tableObject = ref({
|
||||
tableList: [],
|
||||
loading: false,
|
||||
total: 1,
|
||||
pageSize: 20,
|
||||
currentPage: 1
|
||||
const searchForm = ref({
|
||||
productId: undefined,
|
||||
specsId: undefined,
|
||||
warehouseId: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
function setSearchParams() {
|
||||
tableObject.value.tableList = []
|
||||
const opts = ref({
|
||||
product: [],
|
||||
spec: [],
|
||||
warehouse: []
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const tableList = ref([])
|
||||
|
||||
function resetQuery() {
|
||||
searchForm.value = {
|
||||
productId: undefined,
|
||||
specsId: undefined,
|
||||
warehouseId: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
}
|
||||
|
||||
function getTableList() {
|
||||
tableObject.value.tableList = []
|
||||
function getOptions() {
|
||||
getSimpleProductList().then((data) => {
|
||||
opts.value.product = data
|
||||
})
|
||||
getSimpleWarehouseList().then((data) => {
|
||||
opts.value.warehouse = data
|
||||
})
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
searchForm.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function changeProd(val) {
|
||||
if (val) {
|
||||
opts.value.spec = opts.value.product.find((it) => it.productId == val).productSpecList
|
||||
} else {
|
||||
opts.value.spec = []
|
||||
}
|
||||
searchForm.value.specsId = undefined
|
||||
}
|
||||
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await getInventoryList(searchForm.value)
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getOptions()
|
||||
handleSearch()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -1,90 +1,150 @@
|
||||
<template>
|
||||
<div>
|
||||
<Search
|
||||
:schema="allSchemas.searchSchema"
|
||||
labelWidth="0"
|
||||
@search="setSearchParams"
|
||||
@reset="setSearchParams"
|
||||
<el-form inline :model="searchForm" class="-mb-15px" label-width="0">
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.productId"
|
||||
placeholder="选择产品"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeProd"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in opts.product"
|
||||
:key="item.productId"
|
||||
:label="item.productName"
|
||||
:value="item.productId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.specsId"
|
||||
placeholder="选择规格"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!searchForm.productId"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in opts.spec"
|
||||
:key="item.specsId"
|
||||
:label="item.specsName"
|
||||
:value="item.specsId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searchForm.warehouseId" placeholder="仓库" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in opts.warehouse"
|
||||
:key="item.warehouseId"
|
||||
:label="item.warehouseName"
|
||||
:value="item.warehouseId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleSearch"> 搜索 </el-button>
|
||||
<el-button @click="resetQuery"> 重置 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table class="mt-20px" :data="tableList" border>
|
||||
<el-table-column type="index" width="50px" />
|
||||
<el-table-column prop="" label="产品名称" />
|
||||
<el-table-column prop="" label="规格" />
|
||||
<el-table-column prop="" label="变动类型" />
|
||||
<el-table-column prop="" label="数量" />
|
||||
<el-table-column prop="" label="金额" />
|
||||
<el-table-column prop="" label="变动时间" />
|
||||
<el-table-column prop="" label="变动人员" />
|
||||
<el-table-column label="变动类型">
|
||||
<template #default="{ row }">
|
||||
{{ ['', '入库', '出库'][row.changeType] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="数量" />
|
||||
<el-table-column prop="money" label="金额" />
|
||||
<el-table-column prop="changeTime" label="变动时间" :formatter="dateFormatter" />
|
||||
<el-table-column prop="changeUser" label="变动人员" />
|
||||
<el-table-column prop="" label="所属仓库" />
|
||||
<el-table-column prop="" label="备注" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="searchForm.pageSize"
|
||||
v-model:page="searchForm.currentPage"
|
||||
v-model:page="searchForm.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const crudSchemas = ref([
|
||||
{
|
||||
label: '仓库名称',
|
||||
field: 'warehouse',
|
||||
isSearch: true,
|
||||
search: {
|
||||
component: 'Select',
|
||||
api: () => [
|
||||
{ label: '自营仓', value: 1 },
|
||||
{ label: '供应商仓', value: 2 }
|
||||
],
|
||||
componentProps: {
|
||||
optionsAlias: {
|
||||
labelField: 'label',
|
||||
valueField: 'value'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '变动类型',
|
||||
field: 'type',
|
||||
isSearch: true,
|
||||
search: {
|
||||
component: 'Select',
|
||||
api: () => [
|
||||
{ label: '入库', value: 1 },
|
||||
{ label: '出库', value: 2 },
|
||||
{ label: '售后', value: 3 }
|
||||
],
|
||||
componentProps: {
|
||||
optionsAlias: {
|
||||
labelField: 'label',
|
||||
valueField: 'value'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
const { allSchemas } = useCrudSchemas(crudSchemas.value)
|
||||
<script setup name="InventoryDetail">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { getSimpleWarehouseList, getInventoryRecord } from '@/api/mall/warehouse'
|
||||
import { getSimpleProductList } from '@/api/mall/product'
|
||||
|
||||
const searchForm = ref({
|
||||
pageSize: 20,
|
||||
currentPage: 1
|
||||
pproductId: undefined,
|
||||
specsId: undefined,
|
||||
warehouseId: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
const tableList = ref([])
|
||||
const opts = ref({
|
||||
product: [],
|
||||
spec: [],
|
||||
warehouse: []
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const tableList = ref([])
|
||||
|
||||
function getList() {
|
||||
tableList.value = []
|
||||
function resetQuery() {
|
||||
searchForm.value = {
|
||||
productId: undefined,
|
||||
specsId: undefined,
|
||||
warehouseId: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
}
|
||||
|
||||
function setSearchParams() {
|
||||
tableList.value = []
|
||||
function getOptions() {
|
||||
getSimpleProductList().then((data) => {
|
||||
opts.value.product = data
|
||||
})
|
||||
getSimpleWarehouseList().then((data) => {
|
||||
opts.value.warehouse = data
|
||||
})
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
searchForm.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function changeProd(val) {
|
||||
if (val) {
|
||||
opts.value.spec = opts.value.product.find((it) => it.productId == val).productSpecList
|
||||
} else {
|
||||
opts.value.spec = []
|
||||
}
|
||||
searchForm.value.specsId = undefined
|
||||
}
|
||||
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await getInventoryRecord(searchForm.value)
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getOptions()
|
||||
handleSearch()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -1,75 +1,115 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<Search
|
||||
:schema="allSchemas.searchSchema"
|
||||
labelWidth="0"
|
||||
@search="setSearchParams"
|
||||
@reset="setSearchParams"
|
||||
<el-form inline :model="searchForm" class="-mb-15px" label-width="0" @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.warehouseName"
|
||||
placeholder="仓库名称"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<!-- 列表 -->
|
||||
<SSTable
|
||||
class="mt-20px"
|
||||
v-model:tableObject="tableObject"
|
||||
:tableColumns="allSchemas.tableColumns"
|
||||
@get-list="getTableList"
|
||||
>
|
||||
<el-table-column type="index" width="80px" />
|
||||
<el-table-column
|
||||
v-for="item in allSchemas.tableColumns"
|
||||
:key="item.field"
|
||||
:prop="item.field"
|
||||
:label="item.label"
|
||||
/>
|
||||
<el-table-column label="操作" width="200px">
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleSearch"> 搜索 </el-button>
|
||||
<el-button @click="resetQuery"> 重置 </el-button>
|
||||
<el-button type="primary" @click="openForm('create', null)"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table class="mt-20px" :data="tableList" border>
|
||||
<el-table-column type="index" width="50px" />
|
||||
<el-table-column prop="warehouseName" label="仓库名称" />
|
||||
<el-table-column prop="sort" label="排序" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column label="操作" width="120px">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" text :disabled="row.default">修改</el-button>
|
||||
<el-button type="danger" text :disabled="row.default" @click="remove(row)"
|
||||
>删除</el-button
|
||||
<el-button
|
||||
type="primary"
|
||||
style="padding: 0"
|
||||
text
|
||||
@click="openForm('update', row.warehouseId)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button type="danger" style="padding: 0" text @click="handleRemove(row.warehouseId)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</SSTable>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="searchForm.pageSize"
|
||||
v-model:page="searchForm.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<DialogWarehouse ref="warehouseDialog" @success="handleSearch" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const crudSchemas = ref([
|
||||
{
|
||||
label: '仓库名称',
|
||||
field: 'name',
|
||||
isSearch: true,
|
||||
isTable: true
|
||||
}
|
||||
])
|
||||
<script setup name="Warehouse">
|
||||
import DialogWarehouse from './DialogWarehouse.vue'
|
||||
import * as WarehouseApi from '@/api/mall/warehouse'
|
||||
|
||||
const { allSchemas } = useCrudSchemas(crudSchemas.value)
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const tableObject = ref({
|
||||
tableList: [],
|
||||
loading: false,
|
||||
total: 1,
|
||||
pageSize: 20,
|
||||
currentPage: 1
|
||||
const searchForm = ref({
|
||||
warehouseName: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
function setSearchParams() {
|
||||
tableObject.value.tableList = [
|
||||
{ name: '自营仓', default: true },
|
||||
{ name: '供应商仓', default: true }
|
||||
]
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const tableList = ref([])
|
||||
|
||||
function resetQuery() {
|
||||
searchForm.value = {
|
||||
warehouseName: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
}
|
||||
|
||||
function getTableList() {
|
||||
tableObject.value.tableList = [
|
||||
{ name: '自营仓', default: true },
|
||||
{ name: '供应商仓', default: true }
|
||||
]
|
||||
function handleSearch() {
|
||||
searchForm.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function remove(row) {
|
||||
console.log(row)
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await WarehouseApi.getWarehousePage(searchForm.value)
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const warehouseDialog = ref()
|
||||
|
||||
function openForm(type, id) {
|
||||
warehouseDialog.value.open(type, id)
|
||||
}
|
||||
|
||||
async function handleRemove(id) {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await WarehouseApi.deleteWarehouse(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleSearch()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="queryForm" :model="searchForm" label-width="0" inline>
|
||||
<el-form ref="queryForm" :model="searchForm" label-width="0" inline @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.name"
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<el-form :model="form" ref="formRef" label-width="auto">
|
||||
<el-form-item label="采购申请自动通过">
|
||||
<el-radio-group v-model="form.autoAuditPurchase">
|
||||
<el-radio :label="0"> 是 </el-radio>
|
||||
<el-radio :label="1"> 否 </el-radio>
|
||||
<el-radio :label="true"> 是 </el-radio>
|
||||
<el-radio :label="false"> 否 </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in warehouseOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:key="item.warehouseId"
|
||||
:label="item.warehouseName"
|
||||
:value="item.warehouseId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -94,6 +94,11 @@
|
||||
|
||||
<script setup>
|
||||
import * as PurchaseApi from '@/api/mall/purchase'
|
||||
import * as WarehouseApi from '@/api/mall/warehouse'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const props = defineProps({
|
||||
opts: {
|
||||
type: Object,
|
||||
@@ -101,7 +106,8 @@ const props = defineProps({
|
||||
return {
|
||||
product: [],
|
||||
spec: [],
|
||||
supplier: []
|
||||
supplier: [],
|
||||
warehouse: []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,13 +135,16 @@ const rules = {
|
||||
unitPrice: { required: true, message: '采购单价不可为空', trigger: 'change,blur' }
|
||||
}
|
||||
|
||||
const warehouseOptions = ref([
|
||||
{ label: '自营仓', value: 1 },
|
||||
{ label: '供应商仓', value: 2 }
|
||||
])
|
||||
const warehouseOptions = ref([])
|
||||
function getOptions() {
|
||||
WarehouseApi.getSimpleWarehouseList().then((data) => {
|
||||
warehouseOptions.value = data
|
||||
})
|
||||
}
|
||||
|
||||
const open = (val) => {
|
||||
dialogVisible.value = true
|
||||
getOptions()
|
||||
form.value = { ...val } || {
|
||||
productId: undefined,
|
||||
specsId: undefined,
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
<el-date-picker
|
||||
v-model="queryParams.applyTime"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
range-separator="-"
|
||||
start-placeholder="申请时间"
|
||||
end-placeholder="申请时间"
|
||||
@@ -56,6 +58,8 @@
|
||||
<el-date-picker
|
||||
v-model="queryParams.checkTime"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
range-separator="-"
|
||||
start-placeholder="审核时间"
|
||||
end-placeholder="审核时间"
|
||||
@@ -81,11 +85,11 @@
|
||||
:formatter="item.formatter"
|
||||
showOverflowTooltip
|
||||
/>
|
||||
<el-table-column label="操作" width="150px" fixed="right">
|
||||
<el-table-column label="操作" width="240px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="row.status == 1"
|
||||
v-if="row.auditStatus == 1"
|
||||
link
|
||||
@click="handleAudit(row)"
|
||||
v-hasPermi="['mall:purchase:audit']"
|
||||
|
||||
Reference in New Issue
Block a user