将属性集成到产品分类里面
parent
6ee1941db5
commit
170d171a23
|
|
@ -89,6 +89,11 @@
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<router-link :to="'/erp/product/product-category-properties?searchId=' + scope.row.id"
|
||||||
|
v-hasPermi="['erp:product-category-properties:create']"
|
||||||
|
>
|
||||||
|
<el-button link type="primary">属性</el-button>
|
||||||
|
</router-link>
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -138,9 +143,12 @@ const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref<ProductCategoryVO[]>([]) // 列表的数据
|
const list = ref<ProductCategoryVO[]>([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
status: undefined
|
status: undefined
|
||||||
})
|
})
|
||||||
|
const total = ref(0) // 列表的总数
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
|
|
@ -172,7 +180,6 @@ const formRef = ref()
|
||||||
const openForm = (type: string, id?: number) => {
|
const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open(type, id)
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
>
|
>
|
||||||
<el-form-item label="所属分类" prop="productCategoryId">
|
<el-form-item label="所属分类" prop="productCategoryId">
|
||||||
<el-select v-model="formData.productCategoryId" placeholder="请选择所属分类">
|
<el-select v-model="formData.productCategoryId" disabled placeholder="请选择所属分类">
|
||||||
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in productCategoryList"
|
v-for="dict in productCategoryList"
|
||||||
|
|
@ -78,11 +78,12 @@ import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { ProductCategoryPropertiesApi, ProductCategoryPropertiesVO } from '@/api/erp/product/category/productcategoryproperties'
|
import { ProductCategoryPropertiesApi, ProductCategoryPropertiesVO } from '@/api/erp/product/category/productcategoryproperties'
|
||||||
import { ProductCategoryVO } from '@/api/erp/product/category'
|
import { ProductCategoryVO } from '@/api/erp/product/category'
|
||||||
|
|
||||||
/** 从父组件取productCategoryList数组*/
|
/** 从父组件取数据*/
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
productCategoryList: ProductCategoryVO[]
|
productCategoryList: ProductCategoryVO[]
|
||||||
}
|
productCategoryId: number
|
||||||
>();
|
}>();
|
||||||
|
|
||||||
/** ERP 产品分类属性 表单 */
|
/** ERP 产品分类属性 表单 */
|
||||||
defineOptions({ name: 'ProductCategoryPropertiesForm' })
|
defineOptions({ name: 'ProductCategoryPropertiesForm' })
|
||||||
|
|
||||||
|
|
@ -95,7 +96,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
productCategoryId: undefined,
|
productCategoryId: null as number | null,
|
||||||
ifSingleProperty: [],
|
ifSingleProperty: [],
|
||||||
productPropertiesEn: undefined,
|
productPropertiesEn: undefined,
|
||||||
productPropertiesCn: undefined,
|
productPropertiesCn: undefined,
|
||||||
|
|
@ -120,11 +121,14 @@ const open = async (type: string, id?: number) => {
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
resetForm()
|
resetForm()
|
||||||
|
formData.value.productCategoryId = props.productCategoryId
|
||||||
|
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await ProductCategoryPropertiesApi.getProductCategoryProperties(id)
|
formData.value = await ProductCategoryPropertiesApi.getProductCategoryProperties(id)
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +164,7 @@ const submitForm = async () => {
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
productCategoryId: undefined,
|
productCategoryId: 0,
|
||||||
ifSingleProperty: [],
|
ifSingleProperty: [],
|
||||||
productPropertiesEn: undefined,
|
productPropertiesEn: undefined,
|
||||||
productPropertiesCn: undefined,
|
productPropertiesCn: undefined,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.productCategoryId"
|
v-model="queryParams.productCategoryId"
|
||||||
placeholder="请选择类别"
|
placeholder="请选择类别"
|
||||||
|
disabled
|
||||||
clearable
|
clearable
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
>
|
>
|
||||||
|
|
@ -205,7 +206,7 @@
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<ProductCategoryPropertiesForm ref="formRef" @success="getList" :product-category-list="productCategoryList" />
|
<ProductCategoryPropertiesForm ref="formRef" @success="getList" :product-category-id="queryParams.productCategoryId" :product-category-list="productCategoryList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -227,10 +228,12 @@ const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref<ProductCategoryPropertiesVO[]>([]) // 列表的数据
|
const list = ref<ProductCategoryPropertiesVO[]>([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
|
const route = useRoute() // 路由
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
productCategoryId: undefined,
|
productCategoryId: 0,
|
||||||
ifSingleProperty: undefined,
|
ifSingleProperty: undefined,
|
||||||
productPropertiesEn: undefined,
|
productPropertiesEn: undefined,
|
||||||
productPropertiesCn: undefined,
|
productPropertiesCn: undefined,
|
||||||
|
|
@ -239,12 +242,17 @@ const queryParams = reactive({
|
||||||
ifSn: undefined,
|
ifSn: undefined,
|
||||||
createTime: []
|
createTime: []
|
||||||
})
|
})
|
||||||
|
let searchCount = 0
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
if(route.query.searchId && searchCount == 0){
|
||||||
|
searchCount++
|
||||||
|
queryParams.productCategoryId = Number(route.query.searchId)
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const data = await ProductCategoryPropertiesApi.getProductCategoryPropertiesPage(queryParams)
|
const data = await ProductCategoryPropertiesApi.getProductCategoryPropertiesPage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
|
|
@ -324,6 +332,5 @@ const getCategoryName = (id: number | undefined) => {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
searchProductCategory()
|
searchProductCategory()
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue