From 7d4b2d59795662f29e59d02096ef95174d15af96 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 22 Mar 2024 21:08:55 +0800 Subject: [PATCH] add --- src/api/custom_service.ts | 5 ++++ src/hooks/usePaging.ts | 10 ++++++- src/views/custom_service/edit.vue | 19 ++++++++------ src/views/custom_service/index.vue | 42 +++++++----------------------- 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/src/api/custom_service.ts b/src/api/custom_service.ts index a64a159..6a3f9aa 100644 --- a/src/api/custom_service.ts +++ b/src/api/custom_service.ts @@ -24,3 +24,8 @@ export function apiCustomServiceDetail(params: any) { export function apiCustomServiceDelete(params: any) { return request.post({ url: "/custom.custom_service/delete", params }); } + +// 客户售后删除 +export function apiCustomServiceEdit(params: any) { + return request.post({ url: "/custom.custom_service/edit", params }); +} diff --git a/src/hooks/usePaging.ts b/src/hooks/usePaging.ts index 9c33890..421f40c 100644 --- a/src/hooks/usePaging.ts +++ b/src/hooks/usePaging.ts @@ -20,7 +20,15 @@ export function usePaging(options: Options) { loading: firstLoading, count: 0, lists: [] as any[], - extend: {} as Record + extend: {} as Record, + calcWidth:(value:string)=>{ + let list = pager.lists.map(item => item[value]) + const maxLength = list.reduce((max, str) => { + return Math.max(max, str.length); + }, 0); + + return (maxLength*14+24) + } }) // 请求分页接口 const getLists = () => { diff --git a/src/views/custom_service/edit.vue b/src/views/custom_service/edit.vue index de19ad0..277fe26 100644 --- a/src/views/custom_service/edit.vue +++ b/src/views/custom_service/edit.vue @@ -2,7 +2,7 @@
- + @@ -74,7 +74,8 @@ - + @@ -118,7 +119,7 @@
- + @@ -127,7 +128,7 @@ import type { FormInstance } from 'element-plus' import Popup from '@/components/popup/index.vue' import customDialog from '@/components/custom-dialog/index.vue' import salescontractDialog from '@/components/salescontract/index.vue' -import { apiCustomServiceAdd, apiCustomServiceDetail } from '@/api/custom_service' +import { apiCustomServiceAdd, apiCustomServiceDetail, apiCustomServiceEdit } from '@/api/custom_service' import personnelselector from '@/components/personnelselector/index.vue' import type { PropType } from 'vue' import peojectDialog from '@/components/project/index.vue' @@ -179,7 +180,7 @@ const userclick = () => { //确认 const submituser = (e: any) => { formData.processed_user = e.id; - formData.processed_user_name=e.name + formData.processed_user_name = e.name } @@ -193,8 +194,8 @@ const popupTitle = computed(() => { const formData = reactive({ id: '', project_id: '', - project_name:"", - project_code:"", + project_name: "", + project_code: "", contacts: '', custom_master_name: "", custom_master_phone: "", @@ -240,7 +241,9 @@ const handleSubmit = async () => { await formRef.value?.validate() const data = { ...formData, } data.date = data.date.substring(0, 10) - await apiCustomServiceAdd(data) + mode.value == "edit" + ? await apiCustomServiceEdit(data) + : await apiCustomServiceAdd(data) popupRef.value?.close() emit('success') } diff --git a/src/views/custom_service/index.vue b/src/views/custom_service/index.vue index ecf669d..c6c7b4e 100644 --- a/src/views/custom_service/index.vue +++ b/src/views/custom_service/index.vue @@ -55,14 +55,14 @@ 删除 -->
- + - - - - - + + + + + @@ -88,7 +88,8 @@ @click="handleDelete(row.id)"> 删除 - + 详情 @@ -197,31 +198,8 @@ const handledetail = async (data: any) => { detailRef.value?.setFormData(res) } -const labelHead = (h, column, index) => { - - - console.log(column, index) - // let l = column.label.length - // let f = 16 //每个字大小,其实是每个字的比例值,大概会比字体大小差不多大一点, - // column.minWidth = f * l //字大小乘个数即长度 ,注意不要加px像素,这里minWidth只是一个比例值,不是真正的长度 - // //然后将列标题放在一个div块中,注意块的宽度一定要100%,否则表格显示不完全 - // return h('div', { class: 'table-head', style: { width: '100%' } }, [column.label]) - -} - - - -const renderHeader = ({ column }) => { - console.log(column) - column.label = 'dgffjghdfgjhdfjgkh' - - return h("div", [ - h("div", column.label,), - ]); - -}; - - getLists() + + \ No newline at end of file