Przeglądaj źródła

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 rok temu
rodzic
commit
071532bb2f

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

@@ -1,3 +1,4 @@
 export const SENDVCODE = "/user/sendVcode";     //发送验证码
 export const REGISTER = "/user/insertCompany";  //注册
 export const LOGIN = "/user/loginAdmin";        //登录
+export const IMPORTTIMELIST = "/sys-form/getExportTemplate" // 下载模板

+ 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: '下架' } 
+]

+ 24 - 6
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"
@@ -118,7 +123,7 @@
       </template>
       <div class="p-8">
         <div class="ml-4 mr-4">
-          <div class="flex items-center">1、点击下载 <el-link type="primary">产品导入模板.xlsx</el-link></div>
+          <div class="flex items-center">1、点击下载 <el-link type="primary" @click="downloadTemplate(MODUCODE, '产品导入模板.xlsx')">产品导入模板.xlsx</el-link></div>
           <div class="mt-4">2、填写excel文件、产品编号、产品名称、产品类别、标准价格、库存、状态必填</div>
         </div>
       </div>
@@ -131,8 +136,8 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { GETSYSFILED, MOD, GETPERSONNEL, GETTEMPLATE, GETTABLELIST, ADDPRODUCT, ALLDETELE, UPLOADFILE } from './api'
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, createTaskFromType, confirmAction } 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
 }

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts

@@ -30,10 +30,10 @@ instance.interceptors.request.use(
 instance.interceptors.response.use(
   (response: AxiosResponse) => {
     // 对响应数据进行处理
-    if (response.status != 200) {
+    if (response.status !== 200 || response.data.code === 'error') {
       ElNotification.closeAll()
       ElNotification({
-        message: showMessage(response.status), // 传入响应码,匹配响应码对应信息,
+        message: response.status !== 200 ? showMessage(response.status) : response.data.msg,
         type: "error",
       });
     }

+ 13 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/tools.ts

@@ -1,6 +1,7 @@
 import { defalutModalForm } from "@/components/TaskModal/api";
 import { ElMessageBox } from "element-plus";
-import { get } from "./request";
+import { IMPORTTIMELIST } from '../pages/api'
+import { get, post } from "./request";
 /**
  * 判断值是否为空
  * @param value 值
@@ -203,3 +204,14 @@ export function confirmAction(
 export function backPath() {
   window.history.go(-1);
 }
+
+/**
+ * 下载模板
+ * @param mod 模块名称(模板链接)
+ * @param fileName 下载的文件名称
+ */
+export function downloadTemplate(mod: any, fileName: string) {
+  post(`${IMPORTTIMELIST}`, { code: mod }).then((res: any) => {
+    downloadFile(res.data, fileName)
+  });
+}