Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

yusm 11 mesi fa
parent
commit
9a925763ff

+ 3 - 5
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/attachment.vue

@@ -87,11 +87,9 @@ function saveEditClue() {
     }
     const bussinessId = information.value.id
     post(REFIENAMEFILE, { name: renameVal.value, id: bussinessId }).then((res) => {
-        if (res.code == 'ok') {
-            renameDialogVisible.value = false
-            globalPopup?.showSuccess(res.msg || '')
-            emits('refreshData')
-        }
+        renameDialogVisible.value = false
+        globalPopup?.showSuccess(res.msg || '')
+        emits('refreshData')
     }).catch((_err) => { })
 }
 

+ 16 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/information.vue

@@ -132,6 +132,7 @@ const transferValue = ref('')
 const transferOptions = ref<personnelInterface[]>([])
 const generateFormValue = ref({})
 const generateForm = ref<typeof GenerateForm>() // 自定义表单dom
+const productTableListValue = ref<any[]>([])
 const contactsId = ref('')
 const contactsList = ref<optionType[]>([])
 const allVisible = reactive({
@@ -196,17 +197,16 @@ function transferBusiness() {
 
 function claimBusiness() {
     confirmAction(`确定认领【${information.value.name}】商机吗?`).then(() => {
-        console.log('执行认领')
+        transferBusiness()
     })
 }
 
 function editBusiness() {
-    console.log('点击了保存')
-    return
     generateForm.value?.getData().then((res: any) => {
         let formVal = {
             ...res,
             expectedTransactionDate: res.expectedTransactionDate ? formatDateTime(new Date(res.expectedTransactionDate)) : '',
+            businessItemProductList: JSON.stringify(productTableListValue.value)
         }
         allLoading.businessSaveLading = true
         post(UPDATEINSET, { ...formVal }).then((_res) => {
@@ -222,10 +222,23 @@ function editBusiness() {
     })
 }
 
+function editProductShow() {
+    const productList = information.value.businessItemProducts || []
+    const list = productList.map((item: any) => {
+        const { id, productName, productId, productCode, unit, unitName, typeName, type, price, inventory, orderProductDetail, num, discount, sealPrice, totalPrice, quantity } = item
+        return {
+            id, productId: productId, productName, productCode, unit, unitName, typeName, type, price, inventory,
+            num, discount, sealPrice, totalPrice, quantity
+        }
+    })
+    productTableListValue.value = list
+}
+
 function showVisible(type: keyof typeof allVisible) {
     if (type == 'editBusinessVisible') {
         const { name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark } = information.value
         generateFormValue.value = { name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark }
+        editProductShow()
     }
     allVisible[type] = true
 }

+ 1 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/products.vue

@@ -83,9 +83,8 @@ function editProduct() {
     })
     const { id, name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark } = information.value
     const formData = { id, name, customerId, contactsId, amountOfMoney, expectedTransactionDate, stageId, inchargerId, remark }
-    console.log(productTableListData, '<===== 将要提交的数据', formData)
     allLoading.editProductLoading = true
-    post(UPDATEINSET, { ...formData }).then((_res) => {
+    post(UPDATEINSET, { ...formData, businessItemProductList: JSON.stringify(productTableListData) }).then((_res) => {
         allVisible.editProductVisible = false
         globalPopup?.showSuccess('操作成功')
         emits('refreshData')

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/detail/index.vue

@@ -68,7 +68,7 @@
 
       <div class="w-full h-auto flex justify-between mt-2">
         <div class="bg-white shadow-md rounded-md w-full">
-          <Products :information="businessInfo" />
+          <Products :information="businessInfo" @refreshData="getDetail" />
         </div>
       </div>
     </div>

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

@@ -13,4 +13,9 @@ export const URL_ROWBACK = `${PREFIX}/rollback`
 export const URL_THOROUGHLYDETELE = `${PREFIX}/reallyDelete`
 export const URL_CLAIM = `${PREFIX}/claim`
 export const URL_FETALL = `${PREFIX}/getAll`
-export const URL_GETDETAIL = `${PREFIX}/getInfo`
+export const URL_GETDETAIL = `${PREFIX}/getInfo`
+export const URL_IMPORTEXELS = `${PREFIX}/importData`
+export const URL_EXPORTEXELS = `${PREFIX}/exportData`
+export const URL_UPLOADFILE = `${PREFIX}/uploadFile`
+export const URL_DETELEFILE = `${PREFIX}/deleteFile`
+export const URL_REFFILENAME = `${PREFIX}/reFileName`

+ 104 - 45
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/component/attachment.vue

@@ -3,65 +3,124 @@
         <div class="flex justify-between">
             <div class="title">附件</div>
             <div>
-                <el-button type="primary">上传</el-button>
+                <el-upload ref="uploadRef" :http-request="httpUploadFile" :limit="1" :show-file-list="false"
+                    element-loading-text="正在上传">
+                    <template #trigger>
+                        <el-button type="primary">上传</el-button>
+                    </template>
+                </el-upload>
             </div>
         </div>
         <div class="flex-1 overflow-auto pt-3">
             <el-table :data="attachmenttable" border style="width: 100%;height: 200px;">
-                <el-table-column prop="fileName" label="附件名称" width="180" />
-                <el-table-column prop="fileSize" label="附件大小" width="120" />
-                <el-table-column prop="uploader" label="上传人" width="120" />
-                <el-table-column prop="uploadTime" label="上传时间" width="180" />
+                <el-table-column prop="name" label="附件名称" width="180" />
+                <el-table-column prop="size" label="附件大小" width="120" />
+                <el-table-column prop="userName" label="上传人" width="120" />
+                <el-table-column prop="createTime" label="上传时间" width="180" />
                 <el-table-column label="操作" width="180" fixed="right">
                     <template #default="scope">
-                        <el-button link type="primary" size="large">下载</el-button>
-                        <el-button link type="primary" size="large">重命名</el-button>
-                        <el-button link type="danger" size="large">删除</el-button>
+                        <el-button link type="primary" size="large" @click="fileDownload(scope.row)">下载</el-button>
+                        <el-button link type="primary" size="large" @click="showVisible(scope.row)">重命名</el-button>
+                        <el-button link type="danger" size="large" @click="deteleFile(scope.row)">删除</el-button>
                     </template>
                 </el-table-column>
             </el-table>
         </div>
+
+        <!-- 弹窗 -->
+        <el-dialog v-model="renameDialogVisible" width="800" :show-close="false" top="10vh">
+            <template #header="{ close, titleId, titleClass }">
+                <div class="flex justify-between items-center border-b pb-3 dialog-header">
+                    <h4 :id="titleId">{{ '文件重命名' }}</h4>
+                    <div>
+                        <el-button type="primary" @click="saveEditClue()">保存</el-button>
+                        <el-button @click="renameDialogVisible = false">取消</el-button>
+                    </div>
+                </div>
+            </template>
+            <div class="pt-3">
+                <el-input v-model.trim="renameVal" style="width: 100%" class="pb-3" clearable />
+            </div>
+        </el-dialog>
     </div>
 </template>
 <script lang="ts" setup>
-import { ref, reactive, onMounted, onUnmounted, defineExpose, inject } from 'vue'
+import { post, uploadFile } from '@/utils/request';
+import { UploadRequestOptions } from 'element-plus';
+import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
+import { URL_DETELEFILE, URL_REFFILENAME, URL_UPLOADFILE } from '../api';
+import { confirmAction, downloadFile } from '@/utils/tools';
+
+const emits = defineEmits(['refreshData']);
+const globalPopup = inject<GlobalPopup>('globalPopup')
+const props = defineProps<{
+    data: any
+}>()
+const attachmenttable = ref([])
+const information = ref<any>({})
+const uploadRef = <any>ref()
+const renameDialogVisible = ref(false)
+const renameVal = ref('')
+
+// 下载文件
+function fileDownload(item: any) {
+    downloadFile(`${item.path}`, item.name)
+}
+
+// 删除文件
+function deteleFile(item: any) {
+    const id = item.id
+    confirmAction(`确定删除【${item.name}】文件吗?`).then(() => {
+        post(URL_DETELEFILE, { id }).then((_res) => {
+            globalPopup?.showSuccess('删除成功')
+            emits('refreshData')
+        })
+    })
+}
+
+// 保存重命名
+function saveEditClue() {
+    if (!renameVal.value) {
+        globalPopup?.showWarning('请输入文件名称')
+        return
+    }
+    const id = information.value.id
+    post(URL_REFFILENAME, { name: renameVal.value, id: id }).then((res) => {
+        renameDialogVisible.value = false
+        globalPopup?.showSuccess(res.msg || '')
+        emits('refreshData')
+    }).catch((_err) => { })
+}
+
+// 上传文件
+async function httpUploadFile(param: UploadRequestOptions) {
+    const id = information.value.id
+    const formData = new FormData();
+    formData.append('file', param.file)
+    formData.append('id', id)
+    const res = await uploadFile(URL_UPLOADFILE, formData).finally(() => {
+        uploadRef.value.clearFiles()
+    })
+    if (res.code == 'ok') {
+        globalPopup?.showSuccess(res.msg || '')
+        emits('refreshData');
+        return
+    }
+    globalPopup?.showError(res.msg || '')
+    return res
+}
+
+// 显示弹窗
+function showVisible(item: any) {
+    renameVal.value = JSON.parse(JSON.stringify(item.name))
+    renameDialogVisible.value = true
+}
+
+watchEffect(() => {
+    information.value = props.data
+    attachmenttable.value = (props.data.files || [])
+});
 
-const attachmenttable = ref([{
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}, {
-    fileName: '文件附件',
-    fileSize: '3.1MB',
-    uploader: '张三',
-    uploadTime: '2024-04-01',
-}])
 // 生命周期钩子
 onMounted(() => {
 });

File diff suppressed because it is too large
+ 188 - 17
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/component/information.vue


+ 17 - 10
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/detail/index.vue

@@ -13,19 +13,22 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="flex-1 flex flex-col overflow-y-auto overflow-x-hidden scroll-bar" v-loading="allLoading.customerDetailLoading">
+    <div class="flex-1 flex flex-col overflow-y-auto overflow-x-hidden scroll-bar"
+      v-loading="allLoading.customerDetailLoading">
       <div class="w-full h-auto flex justify-between">
         <div class="bg-white shadow-md rounded-md" style="width: 46%;">
-          <Information />
+          <Information :data="information" @refreshData="getDetail" />
         </div>
         <div class="bg-white ml-2 shadow-md rounded-md flex-1">
-          <Attachment />
+          <Attachment :data="information" @refreshData="getDetail" />
         </div>
       </div>
 
       <div class="w-full h-auto flex justify-between mt-2">
         <div class="bg-white shadow-md rounded-md" style="width: 65%;">
-          <RelatedTasks />
+          <DetailCompinents :data="detailCompinentsData" :information="information" :formTaskType="0"
+            :filed="'customId'" :disabledList="['taskType', 'customId']"
+            @refreshData="getDetail" />
         </div>
         <div class="bg-white ml-2 shadow-md rounded-md flex-1">
           <OperationRecord />
@@ -69,7 +72,8 @@ import OperationRecord from '../component/operationRecord.vue';
 import RelatedBusiness from '../component/relatedBusiness.vue';
 import RelatedContacts from "../component/relatedContacts.vue";
 import RelatedOrders from "../component/relatedOrders.vue"
-import { number } from "echarts";
+import DetailCompinents from '@/components/detailcompinents/relatedTasks.vue'
+import { formatDate } from "@/utils/times";
 
 const route = useRoute()
 const globalPopup = inject<GlobalPopup>('globalPopup')
@@ -77,6 +81,7 @@ const rowId = ref(+(route.query.id || ''))
 const values = ref<any>('')
 const options = ref<optionType[]>([])
 const information = ref<any>({})
+const detailCompinentsData = ref([])
 const allLoading = reactive({
   customerDetailLoading: false
 })
@@ -84,7 +89,9 @@ const allLoading = reactive({
 function getDetail() {
   allLoading.customerDetailLoading = true
   post(URL_GETDETAIL, { id: values.value }).then((res) => {
-    information.value = res.data
+    res.data.newCreateTime = formatDate(new Date(res.data.createTime)),
+      information.value = res.data
+      detailCompinentsData.value = res.data.taskList || []
   }).finally(() => {
     allLoading.customerDetailLoading = false
   })
@@ -92,10 +99,10 @@ function getDetail() {
 
 function getAllCustomer() {
   get(URL_FETALL).then(({ data }) => {
-      options.value = data.map((item: any) => ({
-          value: item.id,
-          label: item.customName
-      }))
+    options.value = data.map((item: any) => ({
+      value: item.id,
+      label: item.customName
+    }))
   })
 }
 

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/index.vue

@@ -174,7 +174,7 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { MOD, GETSYSFILED, GETPERSONNEL, URL_TABLELIST, URL_TEMPLALE, URL_EDITSAVE, URL_DETELER, URL_CLAIM, IMPORTMOD, GETALLCLUE } from './api.ts'
+import { MOD, GETSYSFILED, GETPERSONNEL, URL_TABLELIST, URL_TEMPLALE, URL_EDITSAVE, URL_DETELER, URL_CLAIM, IMPORTMOD, GETALLCLUE, URL_IMPORTEXELS, URL_EXPORTEXELS } from './api.ts'
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, getTemplateKey, createTaskFromType, confirmAction, downloadFile, downloadTemplate } from '@/utils/tools'
 import { post, get, uploadFile } from "@/utils/request";
 import { useRouter, useRoute } from "vue-router";
@@ -280,7 +280,7 @@ async function importBusiness(param: UploadRequestOptions) {
   allLoading.importLoading = true
   const formData = new FormData();
   formData.append('multipartFile', param.file)
-  const res = await uploadFile('接口名称', formData).finally(() => {
+  const res = await uploadFile(URL_IMPORTEXELS, formData).finally(() => {
     allLoading.importLoading = false
   })
   if (res.code == 'ok') {
@@ -294,7 +294,7 @@ async function importBusiness(param: UploadRequestOptions) {
 function exportCustomerTableList() {
   allLoading.exoprtLoading = true
   let valueForm = getFromValue(customerCriteriaForm)
-  post('接口名称', { ...valueForm }).then((res) => {
+  post(URL_EXPORTEXELS, { ...valueForm }).then((res) => {
     downloadFile(res.data, allText.exportText)
   }).finally(() => {
     allLoading.exoprtLoading = false