Kaynağa Gözat

提交相关代码

Lijy 11 ay önce
ebeveyn
işleme
dbfb4f121c

+ 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) => { })
 }
 

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

@@ -15,4 +15,7 @@ export const URL_CLAIM = `${PREFIX}/claim`
 export const URL_FETALL = `${PREFIX}/getAll`
 export const URL_GETDETAIL = `${PREFIX}/getInfo`
 export const URL_IMPORTEXELS = `${PREFIX}/importData`
-export const URL_EXPORTEXELS = `${PREFIX}/exportData`
+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(() => {
 });

+ 5 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/component/information.vue

@@ -4,7 +4,7 @@
             <div class="title">基本信息</div>
             <div>
                 <el-button type="primary" @click="claimCustomer()" v-if="!information.inchargerName">认领</el-button>
-                <el-button type="primary" @click="">转移</el-button>
+                <el-button type="primary" @click="transferCli()">转移</el-button>
                 <el-button type="primary" @click="editCustomer()">编辑</el-button>
             </div>
         </div>
@@ -155,7 +155,11 @@ function saveCustomer() {
         console.log(_err)
         globalPopup?.showError('请填写完整')
     })
+}
 
+function transferCli() {
+    transferValue.value
+    showVisible('transferCustomerVisible')
 }
 
 function transferCustomer() {

+ 14 - 9
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 :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,7 @@ 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()
@@ -78,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
 })
@@ -86,7 +90,8 @@ function getDetail() {
   allLoading.customerDetailLoading = true
   post(URL_GETDETAIL, { id: values.value }).then((res) => {
     res.data.newCreateTime = formatDate(new Date(res.data.createTime)),
-    information.value = res.data
+      information.value = res.data
+      detailCompinentsData.value = res.data.taskList || []
   }).finally(() => {
     allLoading.customerDetailLoading = false
   })
@@ -94,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
+    }))
   })
 }