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