【crm:优化产品及产品分类】

This commit is contained in:
ZanGe丶 2023-12-03 21:24:38 +08:00
parent c322959c40
commit dde61c29a0
6 changed files with 86 additions and 91 deletions

View File

@ -33,7 +33,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import * as ProductCategoryApi from '@/api/crm/productCategory' import * as ProductCategoryApi from '@/api/crm/product/productCategory'
import * as ProductApi from '@/api/crm/product' import * as ProductApi from '@/api/crm/product'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { fenToYuan } from '@/utils' import { fenToYuan } from '@/utils'

View File

@ -8,63 +8,87 @@
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="产品名称" prop="name"> <el-row>
<el-input v-model="formData.name" placeholder="请输入产品名称" /> <el-col :span="12">
</el-form-item> <el-form-item label="产品名称" prop="name">
<el-form-item label="产品编码" prop="no"> <el-input v-model="formData.name" placeholder="请输入产品名称" />
<el-input v-model="formData.no" placeholder="请输入产品编码" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="单位" prop="unit"> <el-col :span="12">
<el-select v-model="formData.unit" class="w-1/1" placeholder="请选择单位"> <el-form-item label="产品编码" prop="no">
<el-option <el-input v-model="formData.no" placeholder="请输入产品编码" />
v-for="dict in getIntDictOptions(DICT_TYPE.PRODUCT_UNIT)" </el-form-item>
:key="dict.value" </el-col>
:label="dict.label" </el-row>
:value="dict.value" <el-row>
/> <el-col :span="12">
</el-select> <el-form-item label="单位" prop="unit">
</el-form-item> <el-select v-model="formData.unit" class="w-1/1" placeholder="请选择单位">
<el-form-item label="价格" prop="price"> <el-option
<el-input type="number" v-model="formData.price" placeholder="请输入价格" /> v-for="dict in getIntDictOptions(DICT_TYPE.PRODUCT_UNIT)"
</el-form-item> :key="dict.value"
<el-form-item label="状态" prop="status"> :label="dict.label"
<el-select v-model="formData.status" placeholder="请选择状态"> :value="dict.value"
<el-option />
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_PRODUCT_STATUS)" </el-select>
:key="dict.value" </el-form-item>
:label="dict.label" </el-col>
:value="dict.value" <el-col :span="12">
/> <el-form-item label="价格" prop="price">
</el-select> <el-input type="number" v-model="formData.price" placeholder="请输入价格" />
</el-form-item> </el-form-item>
<el-form-item label="产品分类" prop="categoryId"> </el-col>
<el-cascader </el-row>
v-model="formData.categoryId" <el-row>
:options="productCategoryList" <el-col :span="12">
:props="defaultProps" <el-form-item label="状态" prop="status">
class="w-1/1" <el-select v-model="formData.status" placeholder="请选择状态">
clearable <el-option
placeholder="请选择产品分类" v-for="dict in getIntDictOptions(DICT_TYPE.CRM_PRODUCT_STATUS)"
filterable :key="dict.value"
/> :label="dict.label"
</el-form-item> :value="dict.value"
<el-form-item label="产品描述" prop="description"> />
<el-input v-model="formData.description" placeholder="请输入产品描述" /> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="负责人" prop="ownerUserId"> </el-col>
<el-select <el-col :span="12">
v-model="formData.ownerUserId" <el-form-item label="产品分类" prop="categoryId">
placeholder="请选择负责人" <el-cascader
:disabled="formData.id" v-model="formData.categoryId"
> :options="productCategoryList"
<el-option :props="defaultProps"
v-for="user in userList" class="w-1/1"
:key="user.id" clearable
:label="user.nickname" placeholder="请选择产品分类"
:value="user.id" filterable
/> />
</el-select> </el-form-item>
</el-form-item> </el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="产品描述" prop="description">
<el-input v-model="formData.description" placeholder="请输入产品描述" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="ownerUserId">
<el-select
v-model="formData.ownerUserId"
placeholder="请选择负责人"
:disabled="formData.id"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:value="user.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -75,7 +99,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as ProductApi from '@/api/crm/product' import * as ProductApi from '@/api/crm/product'
import * as ProductCategoryApi from '@/api/crm/productCategory' import * as ProductCategoryApi from '@/api/crm/product/productCategory'
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import { getSimpleUserList, UserVO } from '@/api/system/user' import { getSimpleUserList, UserVO } from '@/api/system/user'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'

View File

@ -17,15 +17,6 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="产品编码" prop="no">
<el-input
v-model="queryParams.no"
placeholder="请输入产品编码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px"> <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
<el-option <el-option
@ -36,26 +27,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="产品分类" prop="categoryId">
<el-input
v-model="queryParams.categoryId"
placeholder="请选择产品分类"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@ -167,7 +138,7 @@ import * as ProductApi from '@/api/crm/product'
import ProductForm from './ProductForm.vue' import ProductForm from './ProductForm.vue'
import ProductDetail from './ProductDetail.vue' import ProductDetail from './ProductDetail.vue'
import { fenToYuan } from '@/utils' import { fenToYuan } from '@/utils'
import * as ProductCategoryApi from '@/api/crm/productCategory' import * as ProductCategoryApi from '@/api/crm/product/productCategory'
import { getSimpleUserList, UserVO } from '@/api/system/user' import { getSimpleUserList, UserVO } from '@/api/system/user'
defineOptions({ name: 'CrmProduct' }) defineOptions({ name: 'CrmProduct' })

View File

@ -29,7 +29,7 @@
</Dialog> </Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as ProductCategoryApi from '@/api/crm/productCategory' import * as ProductCategoryApi from '@/api/crm/product/productCategory'
defineOptions({ name: 'CrmProductCategoryForm' }) defineOptions({ name: 'CrmProductCategoryForm' })

View File

@ -74,7 +74,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as ProductCategoryApi from '@/api/crm/productCategory' import * as ProductCategoryApi from '@/api/crm/product/productCategory'
import ProductCategoryForm from './ProductCategoryForm.vue' import ProductCategoryForm from './ProductCategoryForm.vue'
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'