فهرست منبع

提交客户管家代码

Lijy 1 سال پیش
والد
کامیت
3e268fdcfc

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/api.ts

@@ -16,8 +16,14 @@ export const GETDETAIL = `${prefix}/detail`
 export const GETINCHARGER = `${prefix}/transferIncharger`
 export const GETBUSINESS = `${prefix}/businessListWithProduct`
 export const GETORDER = `${prefix}/orderWithProduct`
+export const EXPORTTIME = `${prefix}/exportData`
 export const UPLOADATTACHMENT = `/attachment/uploadAttachment`
 export const GETCENTERLIST = `/audit-log-center/list`
 export const GETATTACHMENT = `/attachment/attachmentList`
 export const FILEDETELE = `/attachment/delete`
-export const FILERENAME = `/attachment/rename`
+export const FILERENAME = `/attachment/rename`
+
+export const SELECTSTATUS = [
+    { value: 1, label: '上架' },
+    { value: 0, label: '下架' } 
+]

+ 23 - 5
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/index.vue

@@ -15,6 +15,11 @@
                 <el-option v-for="item in fixedData.ProductType" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
+            <el-form-item label="状态">
+              <el-select v-model="filterProductForm.status" placeholder="请选择">
+                <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
+            </el-form-item>
             <el-form-item label="负责人">
               <el-select v-model="filterProductForm.userId" placeholder="请选择">
                 <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
@@ -43,7 +48,7 @@
           <el-button type="primary" @click="batchDelete()">批量删除</el-button>
           <el-button type="primary" @click="showDeteleProduct(true)">回收站</el-button>
           <el-button type="primary" @click="dialogVisible.importVisible = true">导入</el-button>
-          <el-button type="primary">导出</el-button>
+          <el-button type="primary" @click="exportProductTableList()" :loading="allLoading.exoprtLoading">导出</el-button>
         </div>
         <div class="flex-1 w-full overflow-hidden">
           <el-table ref="productTableRef" :data="productTableList" border v-loading="allLoading.productTableLading"
@@ -131,8 +136,8 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { GETSYSFILED, MOD, MODUCODE, GETPERSONNEL, GETTEMPLATE, GETTABLELIST, ADDPRODUCT, ALLDETELE, UPLOADFILE } from './api'
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, createTaskFromType, confirmAction, downloadTemplate } from '@/utils/tools'
+import { GETSYSFILED, MOD, MODUCODE, GETPERSONNEL, GETTEMPLATE, GETTABLELIST, ADDPRODUCT, ALLDETELE, UPLOADFILE, EXPORTTIME } from './api'
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, downloadFile, formatDate, createTaskFromType, confirmAction, downloadTemplate } from '@/utils/tools'
 import { FormInstance, FormRules, ElMessageBox, ElTable, UploadRequestOptions } from 'element-plus'
 import { post, get, uploadFile } from "@/utils/request";
 import { useRouter, useRoute } from "vue-router";
@@ -151,12 +156,14 @@ const filterProductForm = reactive<filterProductFormType>({ // 筛选条件form
   pageSize: 10,
   id: '',
   type: '',
+  status: '',
 })
 const allLoading = reactive({
   productTableLading: false,
   generateFormLading: false,
   saveLoading: false,
-  importLoading: false
+  importLoading: false,
+  exoprtLoading: false
 })
 const dialogVisible = reactive({
   editProductVisible: false,
@@ -272,12 +279,23 @@ async function importProducts(param: UploadRequestOptions) {
   const res = await uploadFile(UPLOADFILE, formData)
   allLoading.importLoading = false
   if (res.code == 'ok') {
-    globalPopup?.showSuccess(res.msg || '')
+    globalPopup?.showSuccess('导入成功' || '')
+    getProductTableList()
     return
   }
   globalPopup?.showError(res.msg || '')
 }
 
+function exportProductTableList() {
+  allLoading.exoprtLoading = true
+  let valueForm = getFromValue(filterProductForm)
+  post(EXPORTTIME, {...valueForm}).then((res) => {
+    downloadFile(res.data, '产品表导出.xlsx')
+  }).finally(() => {
+    allLoading.exoprtLoading = false
+  })
+}
+
 function handleSizeChange(val: number) {
   filterProductForm.pageIndex = 1
   filterProductForm.pageSize = val

+ 2 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/type.d.ts

@@ -7,5 +7,6 @@ interface filterProductFormType {
     type: string | number,
     id: string | number,
     startTime: string,
-    endTime: string
+    endTime: string,
+    status: any
 }