Browse Source

产品管理

lipenghui 5 months ago
parent
commit
c49b1a56e7
2 changed files with 23 additions and 31 deletions
  1. 7 4
      src/views/supplier/detail/SupplierDetailForm.vue
  2. 16 27
      src/views/supplier/detail/index.vue

+ 7 - 4
src/views/supplier/detail/SupplierDetailForm.vue

@@ -23,8 +23,8 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="备注" prop="remark">
-        <el-input v-model="formData.remark" placeholder="请输备注" type="textarea" />
+      <el-form-item label="产品简介" prop="introduction">
+        <el-input v-model="formData.introduction" placeholder="请输入产品简介" type="textarea" />
       </el-form-item>
     </el-form>
     <template #footer>
@@ -37,7 +37,9 @@
 import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 import { CommonStatusEnum } from '@/utils/constants'
 import * as SupplierDetailApi from '@/api/supplier/product/supplierdetail'
-
+const props = defineProps({
+  categoryId: String
+})
 defineOptions({ name: 'SupplierDetailForm' })
 
 const { t } = useI18n() // 国际化
@@ -53,7 +55,7 @@ const formData = ref({
   code: '',
   sort: undefined,
   status: CommonStatusEnum.ENABLE,
-  remark: ''
+  introduction: ''
 })
 const formRules = reactive({
   name: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
@@ -103,6 +105,7 @@ const submitForm = async () => {
   formLoading.value = true
   try {
     const data = formData.value as unknown as SupplierDetailApi.SupplierProductVo
+    data.categoryId = props.categoryId;
     if (formType.value === 'create') {
       await SupplierDetailApi.createSupplierProduct(data)
       message.success(t('common.createSuccess'))

+ 16 - 27
src/views/supplier/detail/index.vue

@@ -78,7 +78,7 @@
 <!--          <dict-tag :type="DICT_TYPE.SYSTEM_ROLE_TYPE" :value="scope.row.type" />-->
 <!--        </template>-->
 <!--      </el-table-column>-->
-      <el-table-column align="center" label="备注" prop="remark" />
+      <el-table-column align="center" label="产品简介" prop="introduction" />
       <el-table-column align="center" label="状态" prop="status">
         <template #default="scope">
           <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
@@ -122,7 +122,7 @@
   </ContentWrap>
 
   <!-- 表单弹窗:添加/修改 -->
-  <SupplierDetailForm ref="formRef" @success="getList" />
+  <SupplierDetailForm ref="formRef" @success="getList" :categoryId="queryParams.categoryId"/>
 </template>
 <script lang="ts" setup>
 import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@@ -146,8 +146,7 @@ const exportLoading = ref(false) // 导出的加载中
 const getList = async () => {
   loading.value = true
   try {
-    debugger;
-    const data = await SupplierDetailApi.getSupplierProductPage(queryParams)
+    const data = await SupplierDetailApi.getSupplierProductPage(queryParams.value)
     list.value = data.list
     total.value = data.total
   } finally {
@@ -157,7 +156,7 @@ const getList = async () => {
 
 /** 搜索按钮操作 */
 const handleQuery = () => {
-  queryParams.pageNo = 1
+  queryParams.value.pageNo = 1
   getList()
 }
 
@@ -173,18 +172,6 @@ const openForm = (type: string, id?: number) => {
   formRef.value.open(type, id)
 }
 
-/** 数据权限操作 */
-const dataPermissionFormRef = ref()
-const openDataPermissionForm = async (row: SupplierDetailApi.SupplierProductVoVO) => {
-  dataPermissionFormRef.value.open(row)
-}
-
-/** 菜单权限操作 */
-const assignMenuFormRef = ref()
-const openAssignMenuForm = async (row: SupplierDetailApi.SupplierProductVo) => {
-  assignMenuFormRef.value.open(row)
-}
-
 /** 删除按钮操作 */
 const handleDelete = async (id: number) => {
   try {
@@ -197,7 +184,14 @@ const handleDelete = async (id: number) => {
     await getList()
   } catch {}
 }
-
+const queryParams = ref({
+  pageNo: 1,
+  pageSize: 10,
+  name: '',
+  categoryId: undefined,
+  createTime: undefined,
+  status: undefined
+}) // 查询参数
 /** 导出按钮操作 */
 const handleExport = async () => {
   try {
@@ -205,25 +199,20 @@ const handleExport = async () => {
     await message.exportConfirm()
     // 发起导出
     exportLoading.value = true
-    const data = await SupplierDetailApi.exportSupplierProduct(queryParams)
+    debugger;
+    const data = await SupplierDetailApi.exportSupplierProduct(queryParams.value)
+    debugger
     download.excel(data, '产品列表.xls')
   } catch {
   } finally {
     exportLoading.value = false
   }
 }
-const queryParams = ref({
-  pageNo: 1,
-  pageSize: 10,
-  name: '',
-  categoryId: undefined,
-  createTime: undefined
-}) // 查询参数
 /** 初始化 **/
 onMounted(() => {
   // 解析路由的 categoryId
   if (route.query.categoryId) {
-    queryParams.value.categoryId = Number(route.query.categoryId)
+    queryParams.value.categoryId = route.query.categoryId
   }
   getList()
 })