Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-29 15:12:03 +08:00

View File

@@ -1,6 +1,25 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-button type="primary" @click="addGood(1)">添加商品</n-button>
<n-grid class="mb-10" x-gap="12">
<n-gi span="12" mt-10 flex items-center>
<span w-100>筛选条件:</span>
<n-input-group>
<n-select
v-model:value="queryParams.selectKey"
:style="{ width: '20%' }"
:options="selectOptions"
placeholder="请选择"
/>
<n-input v-model:value="queryParams.word" :style="{ width: '30%' }" />
</n-input-group>
</n-gi>
<n-gi span="24" mt-10 flex items-center>
<n-button type="primary" @click="getList">查询</n-button>
<n-button ml-10 @click="clear">重置</n-button>
<n-button ml-10 type="primary" @click="addGood(1)">添加商品</n-button>
</n-gi>
</n-grid>
<n-data-table
:loading="loading"
:columns="columns"
@@ -21,6 +40,18 @@ import { useGoodsStore } from '@/store/modules/goods'
const loading = ref(false)
const selectOptions = ref([
{
label: '商品名称',
value: 0,
},
])
const queryParams = ref({
selectKey: 0,
word: '',
})
const columns = ref([
{
title: 'ID',
@@ -160,6 +191,7 @@ const getList = async () => {
const res = await api.getGoods({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
name: queryParams.value.word,
})
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
@@ -182,6 +214,11 @@ const toEdit = (item) => {
setRow(item)
addGood()
}
const clear = () => {
queryParams.value.word = ''
getList()
}
</script>
<style lang="scss" scoped></style>