将属性,故障,部位集成到产品分类里面

pull/744/head
没钱 2025-03-07 14:18:50 +08:00
parent 170d171a23
commit 9e4a84822a
7 changed files with 58 additions and 19 deletions

View File

@ -9,7 +9,7 @@
> >
<el-form-item label="类别" prop="productCategoryId"> <el-form-item label="类别" prop="productCategoryId">
<!-- 普通显示 --> <!-- 普通显示 -->
<el-select v-model="formData.productCategoryId" placeholder="请选择类别" @change="limitFaultPart" filterable clearable> <el-select v-model="formData.productCategoryId" placeholder="请选择类别" @change="limitFaultPart" disabled filterable clearable>
<el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -73,8 +73,10 @@ import { ProductCategoryVO } from '@/api/erp/product/category'
import { ProductCategoryPartApi, ProductCategoryPartVO} from '@/api/erp/product/category/productcategorypart' import { ProductCategoryPartApi, ProductCategoryPartVO} from '@/api/erp/product/category/productcategorypart'
/** 从父组件取productCategoryList数组*/ /** 从父组件取productCategoryList数组*/
defineProps<{ const props = defineProps<{
productCategoryList: ProductCategoryVO[] productCategoryList: ProductCategoryVO[]
productCategoryId: number
} }
>(); >();
@ -97,7 +99,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,
productFaultPart: undefined, productFaultPart: undefined,
productFault: undefined, productFault: undefined,
ifAffectSale: undefined, ifAffectSale: undefined,
@ -120,6 +122,8 @@ 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
@ -167,7 +171,7 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
productCategoryId: undefined, productCategoryId: null as number | null,
productFaultPart: undefined, productFaultPart: undefined,
productFault: undefined, productFault: undefined,
ifAffectSale: undefined, ifAffectSale: undefined,

View File

@ -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"
> >
@ -215,7 +216,7 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ProductCategoryFaultForm ref="formRef" @success="getList" :product-category-list="productCategoryList" /> <ProductCategoryFaultForm ref="formRef" @success="getList" :product-category-list="productCategoryList" :product-category-id="queryParams.productCategoryId"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -241,7 +242,7 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
productCategoryId: undefined, productCategoryId: null as number | null,
productFaultPart: undefined, productFaultPart: undefined,
productFault: undefined, productFault: undefined,
createTime: [], createTime: [],
@ -255,9 +256,18 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const route = useRoute() //
let searchCount = 0
/** 查询列表 */ /** 查询列表 */
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 ProductCategoryFaultApi.getProductCategoryFaultPage(queryParams) const data = await ProductCategoryFaultApi.getProductCategoryFaultPage(queryParams)
list.value = data.list list.value = data.list

View File

@ -90,10 +90,20 @@
<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" <router-link :to="'/erp/product/product-category-properties?searchId=' + scope.row.id"
v-hasPermi="['erp:product-category-properties:create']" v-hasPermi="['erp:product-category-properties:query']"
> >
<el-button link type="primary">属性</el-button> <el-button link type="primary">属性</el-button>
</router-link> </router-link>
<router-link :to="'/erp/product/product-category-fault?searchId=' + scope.row.id"
v-hasPermi="['erp:product-category-fault:query']"
>
<el-button link type="primary">故障</el-button>
</router-link>
<router-link :to="'/erp/product/product-category-part?searchId=' + scope.row.id"
v-hasPermi="['erp:product-category-part:query']"
>
<el-button link type="primary">部位</el-button>
</router-link>
<el-button <el-button
link link
type="primary" type="primary"
@ -134,6 +144,7 @@ import download from '@/utils/download'
import { ProductCategoryApi, ProductCategoryVO } from '@/api/erp/product/category' import { ProductCategoryApi, ProductCategoryVO } from '@/api/erp/product/category'
import ProductCategoryForm from './ProductCategoryForm.vue' import ProductCategoryForm from './ProductCategoryForm.vue'
/** ERP 产品分类 列表 */ /** ERP 产品分类 列表 */
defineOptions({ name: 'ErpProductCategory' }) defineOptions({ name: 'ErpProductCategory' })
@ -146,7 +157,7 @@ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
status: undefined status: undefined,
}) })
const total = ref(0) // const total = ref(0) //
const queryFormRef = ref() // const queryFormRef = ref() //

View File

@ -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="请选择类别" filterable clearable> <el-select v-model="formData.productCategoryId" placeholder="请选择类别" disabled filterable clearable>
<el-option <el-option
v-for="item in productCategoryList" v-for="item in productCategoryList"
:key="item.id" :key="item.id"
@ -37,12 +37,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { defineProps } from 'vue'; import { defineProps } from 'vue';
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict' import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
import { ProductCategoryApi , ProductCategoryVO } from '@/api/erp/product/category' import { ProductCategoryVO } from '@/api/erp/product/category'
import { ProductCategoryPartApi, ProductCategoryPartVO } from '@/api/erp/product/category/productcategorypart' import { ProductCategoryPartApi, ProductCategoryPartVO } from '@/api/erp/product/category/productcategorypart'
/** 从父组件取productCategoryList数组*/ /** 从父组件取productCategoryList数组*/
defineProps<{ const props = defineProps<{
productCategoryList: ProductCategoryVO[] productCategoryList: ProductCategoryVO[]
productCategoryId: number
} }
>(); >();
@ -59,7 +60,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,
productFaultPart: undefined productFaultPart: undefined
}) })
const formRules = reactive({ const formRules = reactive({
@ -74,6 +75,8 @@ 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
@ -114,7 +117,7 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
productCategoryId: undefined, productCategoryId: null as number | null,
productFaultPart: undefined productFaultPart: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()

View File

@ -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"
> >
@ -125,7 +126,7 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ProductCategoryPartForm ref="formRef" @success="getList" :product-category-list="productCategoryList"/> <ProductCategoryPartForm ref="formRef" @success="getList" :product-category-list="productCategoryList" :product-category-id="queryParams.productCategoryId"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -135,6 +136,10 @@ import download from '@/utils/download'
import { ProductCategoryPartApi, ProductCategoryPartVO } from '@/api/erp/product/category/productcategorypart' import { ProductCategoryPartApi, ProductCategoryPartVO } from '@/api/erp/product/category/productcategorypart'
import ProductCategoryPartForm from './ProductCategoryPartForm.vue' import ProductCategoryPartForm from './ProductCategoryPartForm.vue'
import { ProductCategoryApi , ProductCategoryVO } from '@/api/erp/product/category' import { ProductCategoryApi , ProductCategoryVO } from '@/api/erp/product/category'
const route = useRoute() //
let searchCount = 0
/** ERP 产品分类的数组 */ /** ERP 产品分类的数组 */
const productCategoryList = ref<ProductCategoryVO[]>([]) const productCategoryList = ref<ProductCategoryVO[]>([])
@ -150,7 +155,7 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
productCategoryId: undefined, productCategoryId: null as number | null,
productFaultPart: undefined, productFaultPart: undefined,
createTime: [] createTime: []
}) })
@ -160,6 +165,10 @@ 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 ProductCategoryPartApi.getProductCategoryPartPage(queryParams) const data = await ProductCategoryPartApi.getProductCategoryPartPage(queryParams)
list.value = data.list list.value = data.list

View File

@ -164,7 +164,7 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
productCategoryId: 0, productCategoryId: null as number | null,
ifSingleProperty: [], ifSingleProperty: [],
productPropertiesEn: undefined, productPropertiesEn: undefined,
productPropertiesCn: undefined, productPropertiesCn: undefined,

View File

@ -217,6 +217,10 @@ import { ProductCategoryPropertiesApi, ProductCategoryPropertiesVO } from '@/api
import ProductCategoryPropertiesForm from './ProductCategoryPropertiesForm.vue' import ProductCategoryPropertiesForm from './ProductCategoryPropertiesForm.vue'
import { ProductCategoryApi , ProductCategoryVO } from '@/api/erp/product/category' import { ProductCategoryApi , ProductCategoryVO } from '@/api/erp/product/category'
const route = useRoute() //
let searchCount = 0
/** ERP 产品分类的数组 */ /** ERP 产品分类的数组 */
const productCategoryList = ref<ProductCategoryVO[]>([]) const productCategoryList = ref<ProductCategoryVO[]>([])
/** ERP 产品分类属性 列表 */ /** ERP 产品分类属性 列表 */
@ -228,12 +232,11 @@ 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: 0, productCategoryId: null as number | null,
ifSingleProperty: undefined, ifSingleProperty: undefined,
productPropertiesEn: undefined, productPropertiesEn: undefined,
productPropertiesCn: undefined, productPropertiesCn: undefined,
@ -242,7 +245,6 @@ 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) //