diff --git a/src/api/clue/index.ts b/src/api/clue/index.ts index 479012c..1621be9 100644 --- a/src/api/clue/index.ts +++ b/src/api/clue/index.ts @@ -17,6 +17,8 @@ export const createClueRecord = (params: any) => defHttp.post({ url: '/dating-cl export const editClueRecord = (params: any) => defHttp.post({ url: '/dating-clue-service/user/edit/dating-clue', params }) +export const importClueRecord = (params: any) => defHttp.post({ url: '/dating-clue-service/user/import/dating-clue', params }) + export const allocateCluing = (params: any) => defHttp.post({ url: '/dating-clue-service/user/batch-allocate/dating-clue', params }) export const getClueInfo = (id: string) => defHttp.get({ url: '/dating-clue-service/user/get/dating-clue-detail', params: { id } }) diff --git a/src/views/clue/cluePool/modal.vue b/src/views/clue/cluePool/modal.vue index 5fa8759..60f9546 100644 --- a/src/views/clue/cluePool/modal.vue +++ b/src/views/clue/cluePool/modal.vue @@ -87,11 +87,11 @@ import { BasicForm, useForm } from '/@/components/Form' import { BasicModal, useModalInner } from '/@/components/Modal' import { CropperAvatar } from '/@/components/Cropper'; - import { createClueRecord, editClueRecord } from '/@/api/clue' + import { createClueRecord, importClueRecord } from '/@/api/clue' const activeKey2 = ref('1') - const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue, updateSchema }] = + const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ labelWidth: 108, schemas: modalFormSchema, @@ -116,17 +116,6 @@ confirmLoading: false, title: ifUpdate.value ? '导入线索' : '新增线索', }) - await updateSchema({ - field: 'franchiseFee', - componentProps: { - disabled: ifUpdate.value, - }, - }) - if (unref(ifUpdate)) { - await setFieldsValue({ - ...data.record, - }) - } }) // 择偶标准表单配置 @@ -153,6 +142,12 @@ const emits = defineEmits(['success']) async function handleOk() { try { + if(ifUpdate.value){ + await importClueRecord({keyList: tableListRef.value[0].header, dataList: tableListRef.value[0].dataSource}) + createMessage.success(`导入成功!`) + emits('success') + return + } await validate() const values: any = getFieldsValue() // console.log({...values, ...basicInfoData.value}) @@ -183,17 +178,15 @@ domicilePlaceCityCode: domicilePlace?.[1], domicilePlaceProvinceCode: domicilePlace?.[0] } - - const fun = unref(ifUpdate) ? editClueRecord : createClueRecord - await fun(param) - createMessage.success(`${unref(ifUpdate) ? '编辑' : '新增'}成功!`) + await createClueRecord(param) + createMessage.success(`新增成功!`) emits('success') } finally { setModalProps({ confirmLoading: false }) } } - const tableListRef = ref<{ title: string; columns?: any[]; dataSource?: any[];}[]>([]); + const tableListRef = ref<{ title: string; columns?: any[]; dataSource?: any[]; header:any[];}[]>([]); function loadDataSuccess(excelDataList: ExcelData[]) { tableListRef.value = []; @@ -204,7 +197,7 @@ for (const title of header) { columns.push({ title, dataIndex: title }); } - tableListRef.value.push({ title: sheetName, dataSource: results, columns }); + tableListRef.value.push({ title: sheetName, dataSource: results, columns, header }); } }