diff --git a/src/views/customer/advice/adviceEdit.vue b/src/views/customer/advice/adviceEdit.vue index 0dafa50..71da364 100644 --- a/src/views/customer/advice/adviceEdit.vue +++ b/src/views/customer/advice/adviceEdit.vue @@ -4,14 +4,13 @@ */ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' -import type { FormInstance, UploadUserFile } from 'element-plus' -import type { ICustomer, customerPerson } from './advice_interface' -import showPhoto from '@/views/system/tool/showPhoto.vue' -import { UploadFile } from '@/api/measure/file' -import { addCustomer, getCustomerDetail, updateCustomer } from '@/api/customer/customer' -import { validatePhone } from '@/utils/validate' +import dayjs from 'dayjs' +import type { FormInstance } from 'element-plus' +import type { IAdvice, SimpleCompany } from './advice_interface' +import { addAdvice, getAdviceDetail, updateAdvice } from '@/api/customer/advice' import { SCHEDULE } from '@/utils/scheduleDict' import type { IAddress } from '@/components/AddressSelect/address-interface' +import { getDictByCode } from '@/api/system/dict' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id const pageType = ref('add') // 页面类型: add, edit, detail @@ -20,7 +19,13 @@ edit: '编辑', add: '新建', detail: '详情', -}// 字典 +} +// 字典 +interface dictType { + id: string + name: string + value: string +} // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { @@ -29,77 +34,57 @@ infoId.value = $route.params.id as string } } -const dataForm: Ref = ref({ +const dataForm: Ref = ref({ id: '', - businessContent: '', - customerName: '', - customerNo: '', - bankAccount: '', - bankAccountNumber: '', - bankName: '', - briefName: '', - businessScope: '', - grade: '', // 履约评级 - companySize: '', // 公司规模 - businessSize: '', // 业务规模 - evaluation: '', // 整体评价 - companyAddress: '', - companyArea: '', - companyCity: '', - companyCountry: '', - companyProvince: '', - companyAreaName: '', - companyCityName: '', - companyCountryName: '', - companyProvinceName: '', - director: '', - fax: '', - invoiceAddress: '', - invoiceArea: '', - invoiceCity: '', - invoiceCountry: '', - invoiceProvince: '', - invoiceAreaName: '', - invoiceCityName: '', - invoiceCountryName: '', - invoiceProvinceName: '', - mailbox: '', - minioFileName: '', - mobile: '', - phone: '', - postalCode: '', - remark: '', - taxNumber: '', - website: '', - customerPersonList: [], + adviceNo: '', // 投诉编号 + adviceClass: '', // 投诉类型 + adviceType: '', // 投诉类别 + advicePerson: '', // 投诉人-名称 + personPhone: '', // 投诉人联系方式 + customerName: '', // 公司名称 + customerNo: '', // 客户编号 + customerId: '', // 客户id + content: '', // 投诉内容 + handleStatus: '', // 处置状态 + handleMessage: '', // 处置意见 + adviceTime: '', // 投诉时间 }) -const companyAddress = ref([]) // 公司地址 -const invoiceAddress = ref([]) // 开票地址 -const customerPersonList: Ref = ref([]) // 人员列表 -const columns = ref([ - { text: '人员编号', value: 'personNo', required: false }, - { text: '姓名', value: 'name', required: true }, - { text: '工作部门', value: 'department', required: false }, - { text: '职务', value: 'job', required: false }, - { text: '联系方式', value: 'phone', required: true, reg: validatePhone }, -]) +const companyInfo: SimpleCompany = reactive({ + customerName: '', // 公司名称 + customerNo: '', // 客户编号 + customerId: '', // 客户id + grade: '', // 履约评级 + gradeName: '', // 履约评级 + companySize: '', // 公司规模 + companySizeName: '', // 公司规模 + businessSize: '', // 业务规模 + businessSizeName: '', // 业务规模 + evaluation: '', // 整体评价 + evaluationName: '', // 整体评价 +}) const ruleFormRef = ref() -// 人员对象 -const addPersonObj: customerPerson = { - id: '', - personNo: '', - name: '', - department: '', - job: '', - phone: '', - editable: true, + +const adviceClassList = ref([]) // 投诉建议类型 +const adviceTypeList = ref([]) // 投诉建议类别 +function getDict() { + // 获取公司规模 + getDictByCode('adviceClass').then((response) => { + adviceClassList.value = response.data + }) + // 获取业务规模 + getDictByCode('adviceType').then((response) => { + adviceTypeList.value = response.data + }) } -const SelectionList: Ref = ref([]) +getDict() + // 校验规则 const rules = ref({ - customerName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], - businessContent: [{ required: true, message: '业务内容不能为空', trigger: 'blur' }], - taxNumber: [{ required: true, message: '税号不能为空', trigger: 'blur' }], + customerName: [{ required: true, message: '公司名称不能为空', trigger: ['blur', 'change'] }], + advicePerson: [{ required: true, message: '投诉人不能为空', trigger: ['blur', 'change'] }], + adviceClass: [{ required: true, message: '投诉/建议类型必选', trigger: ['blur', 'change'] }], + adviceTime: [{ required: true, message: '投诉/建议时间不能为空', trigger: ['blur', 'change'] }], + adviceType: [{ required: true, message: '投诉/建议类别必选', trigger: ['blur', 'change'] }], }) // 表单验证规则 // 初始化router const $router = useRouter() @@ -108,82 +93,59 @@ $router.back() } const getInfo = () => { - getCustomerDetail({ id: infoId.value }).then((res) => { - dataForm.value = res.data - companyAddress.value = [dataForm.value.companyCountry, dataForm.value.companyProvince, dataForm.value.companyCity, dataForm.value.companyArea, dataForm.value.companyAddress] - invoiceAddress.value = [dataForm.value.invoiceCountry, dataForm.value.invoiceProvince, dataForm.value.invoiceCity, dataForm.value.invoiceArea, dataForm.value.invoiceAddress] - }) -} -// 表格选中 -const handleSelectionChange = (e: customerPerson[]) => { - SelectionList.value = e -} - -// 公司地址变化后给对象赋值 -function companyAddressChange(addressObj: IAddress) { - dataForm.value.companyCountry = addressObj.country - dataForm.value.companyProvince = addressObj.province - dataForm.value.companyCity = addressObj.city - dataForm.value.companyArea = addressObj.area - dataForm.value.companyAddress = addressObj.address - dataForm.value.companyCountryName = addressObj.countryName - dataForm.value.companyProvinceName = addressObj.provinceName - dataForm.value.companyCityName = addressObj.cityName - dataForm.value.companyAreaName = addressObj.areaName -} - -function invoiceAddressChange(addressObj: IAddress) { - dataForm.value.invoiceCountry = addressObj.country - dataForm.value.invoiceProvince = addressObj.province - dataForm.value.invoiceCity = addressObj.city - dataForm.value.invoiceArea = addressObj.area - dataForm.value.invoiceAddress = addressObj.address - dataForm.value.invoiceCountryName = addressObj.countryName - dataForm.value.invoiceProvinceName = addressObj.provinceName - dataForm.value.invoiceCityName = addressObj.cityName - dataForm.value.invoiceAreaName = addressObj.areaName -} -// 点击增加行 -const addRow = () => { - // 检查上一行必填项 - if (checkPersonList()) { - setAllRowReadable() - customerPersonList.value.push({ ...addPersonObj }) - } -} -// 检查人员列表 -function checkPersonList() { - for (let index = 0; index < customerPersonList.value.length; index++) { - const item = customerPersonList.value[index] - for (const prop of columns.value) { - // 检查必填 - if (prop.required && !item[prop.value]) { - ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) - return false - } - // 验证正则 - if (prop.reg && typeof prop.reg === 'function') { - if (!prop.reg(item[prop.value])) { - ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) - return false - } - } + loading.value = true + getAdviceDetail({ id: infoId.value }).then((res) => { + res.data = { + id: '1597579843411234817', + adviceNo: 'ts202201022131', // 投诉编号 + adviceClass: '0', // 投诉类型 + adviceType: '1', // 投诉类别 + advicePerson: '张三', // 投诉人-名称 + personPhone: '87447', // 投诉人联系方式 + customerName: '特别大公司', // 公司名称 + adviceTime: '2022-12-25 23:58:00', + customerNo: '', // 客户编号 + customerId: '', // 客户id + content: '没人接电话', // 投诉内容 + handleStatus: '0', // 处置状态-0未处置,1已处置 + handleMessage: '', // 处置意见 } - } - return true + dataForm.value = res.data + loading.value = false + }) } -// 删除行 -const deleteList = () => { - customerPersonList.value = customerPersonList.value.filter((item: customerPerson) => { - return !SelectionList.value.includes(item) - }) +const tempCompanyList = ref([ + { customerId: '111', customerNo: '12312456', customerName: '京东', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '112', customerNo: '12312451', customerName: '阿里', businessSizeName: '0~10万', companySizeName: '大企业', gradeName: '一般', evaluationName: '重点客户' }, + { customerId: '113', customerNo: '12312452', customerName: '淘宝', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '114', customerNo: '12312453', customerName: '天猫', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '115', customerNo: '12312454', customerName: '203d', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '116', customerNo: '12312456', customerName: '万达', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, +]) +// 查询公司列表 +const queryCompany = (queryString: string, cb: any) => { + // TODO: 远程查询符合要求的公司列表 + const results = queryString ? tempCompanyList.value.filter((item) => { item.customerName.includes(queryString) }) : tempCompanyList.value + cb(results) +} + +// 选中 +const handleCompanySelect = (select: Record) => { + const item = select as SimpleCompany + companyInfo.customerName = item.customerName + companyInfo.customerNo = item.customerNo + companyInfo.customerId = item.customerId + companyInfo.gradeName = item.gradeName + companyInfo.companySizeName = item.companySizeName + companyInfo.businessSizeName = item.businessSizeName + companyInfo.evaluationName = item.evaluationName } // 打印表单 const printObj = ref({ id: 'form', // 需要打印元素的id - popTitle: '客户详情', // 打印配置页上方的标题 - extraHead: '

客户详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 + popTitle: '投诉/建议详情', // 打印配置页上方的标题 + // extraHead: '

投诉/建议详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 preview: false, // 是否启动预览模式,默认是false standard: '', extarCss: '', @@ -203,109 +165,67 @@ type: 'warning', }, ).then(() => { - addCustomer(dataForm.value).then((res) => { - if (res.code === 200) { - dataForm.value.id = res.data.id - dataForm.value.customerNo = res.data.customerNo - ElMessage.success('已保存') - } - }) + if (dataForm.value.id) { + updateAdvice(dataForm.value).then((res) => { + if (res.code === 200) { + dataForm.value.id = res.data.id + dataForm.value.customerNo = res.data.customerNo + ElMessage.success('已保存') + $router.go(-1) + } + }) + } + else { + addAdvice(dataForm.value).then((res) => { + if (res.code === 200) { + dataForm.value.id = res.data.id + dataForm.value.customerNo = res.data.customerNo + ElMessage.success('已保存') + $router.go(-1) + } + }) + } }) } }) } - -// 提交表单 -function submitForm() { - if (dataForm.value.id) { - const params = { - id: dataForm.value.id, - formId: SCHEDULE.SUPPLIER_APPROVAL, // 表单id - } - addCustomer(params).then((res) => { - ElMessage.success('提交成功') - close() - }) - } - else { - ElMessage.info('请先保存再提交!') - } -} -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const fileRef = ref() // 文件上传input -const onFileChange = (event: any) => { - // 原生上传 - console.log(event.target.files) - if (event.target.files?.length !== 0) { - // 创建formdata对象 - const fd = new FormData() - fd.append('multipartFile', event.target.files[0]) - UploadFile(fd).then((res) => { - if (res.code === 200) { - dataForm.value.minioFileName = res.data[0] - // 重置当前验证 - ElMessage.success('文件上传成功') - } - else { - ElMessage.error(res.message) - } - }) - } -} -const upload = () => { - fileRef.value.click() -} -// 双击行显示输入框 -const dblclickRow = (row: customerPerson) => { - setAllRowReadable() - row.editable = true -} -// 将所有人员信息列表置为不可编辑状态 -function setAllRowReadable() { - for (const item of customerPersonList.value) { - item.editable = false - } -} // 非添加页面获取详情 if (pageType.value !== 'add') { getInfo() } +else { + dataForm.value.adviceTime = dayjs().format('YYYY-MM-DD HH:mm:ss') +} diff --git a/src/views/customer/advice/adviceEdit.vue b/src/views/customer/advice/adviceEdit.vue index 0dafa50..71da364 100644 --- a/src/views/customer/advice/adviceEdit.vue +++ b/src/views/customer/advice/adviceEdit.vue @@ -4,14 +4,13 @@ */ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' -import type { FormInstance, UploadUserFile } from 'element-plus' -import type { ICustomer, customerPerson } from './advice_interface' -import showPhoto from '@/views/system/tool/showPhoto.vue' -import { UploadFile } from '@/api/measure/file' -import { addCustomer, getCustomerDetail, updateCustomer } from '@/api/customer/customer' -import { validatePhone } from '@/utils/validate' +import dayjs from 'dayjs' +import type { FormInstance } from 'element-plus' +import type { IAdvice, SimpleCompany } from './advice_interface' +import { addAdvice, getAdviceDetail, updateAdvice } from '@/api/customer/advice' import { SCHEDULE } from '@/utils/scheduleDict' import type { IAddress } from '@/components/AddressSelect/address-interface' +import { getDictByCode } from '@/api/system/dict' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id const pageType = ref('add') // 页面类型: add, edit, detail @@ -20,7 +19,13 @@ edit: '编辑', add: '新建', detail: '详情', -}// 字典 +} +// 字典 +interface dictType { + id: string + name: string + value: string +} // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { @@ -29,77 +34,57 @@ infoId.value = $route.params.id as string } } -const dataForm: Ref = ref({ +const dataForm: Ref = ref({ id: '', - businessContent: '', - customerName: '', - customerNo: '', - bankAccount: '', - bankAccountNumber: '', - bankName: '', - briefName: '', - businessScope: '', - grade: '', // 履约评级 - companySize: '', // 公司规模 - businessSize: '', // 业务规模 - evaluation: '', // 整体评价 - companyAddress: '', - companyArea: '', - companyCity: '', - companyCountry: '', - companyProvince: '', - companyAreaName: '', - companyCityName: '', - companyCountryName: '', - companyProvinceName: '', - director: '', - fax: '', - invoiceAddress: '', - invoiceArea: '', - invoiceCity: '', - invoiceCountry: '', - invoiceProvince: '', - invoiceAreaName: '', - invoiceCityName: '', - invoiceCountryName: '', - invoiceProvinceName: '', - mailbox: '', - minioFileName: '', - mobile: '', - phone: '', - postalCode: '', - remark: '', - taxNumber: '', - website: '', - customerPersonList: [], + adviceNo: '', // 投诉编号 + adviceClass: '', // 投诉类型 + adviceType: '', // 投诉类别 + advicePerson: '', // 投诉人-名称 + personPhone: '', // 投诉人联系方式 + customerName: '', // 公司名称 + customerNo: '', // 客户编号 + customerId: '', // 客户id + content: '', // 投诉内容 + handleStatus: '', // 处置状态 + handleMessage: '', // 处置意见 + adviceTime: '', // 投诉时间 }) -const companyAddress = ref([]) // 公司地址 -const invoiceAddress = ref([]) // 开票地址 -const customerPersonList: Ref = ref([]) // 人员列表 -const columns = ref([ - { text: '人员编号', value: 'personNo', required: false }, - { text: '姓名', value: 'name', required: true }, - { text: '工作部门', value: 'department', required: false }, - { text: '职务', value: 'job', required: false }, - { text: '联系方式', value: 'phone', required: true, reg: validatePhone }, -]) +const companyInfo: SimpleCompany = reactive({ + customerName: '', // 公司名称 + customerNo: '', // 客户编号 + customerId: '', // 客户id + grade: '', // 履约评级 + gradeName: '', // 履约评级 + companySize: '', // 公司规模 + companySizeName: '', // 公司规模 + businessSize: '', // 业务规模 + businessSizeName: '', // 业务规模 + evaluation: '', // 整体评价 + evaluationName: '', // 整体评价 +}) const ruleFormRef = ref() -// 人员对象 -const addPersonObj: customerPerson = { - id: '', - personNo: '', - name: '', - department: '', - job: '', - phone: '', - editable: true, + +const adviceClassList = ref([]) // 投诉建议类型 +const adviceTypeList = ref([]) // 投诉建议类别 +function getDict() { + // 获取公司规模 + getDictByCode('adviceClass').then((response) => { + adviceClassList.value = response.data + }) + // 获取业务规模 + getDictByCode('adviceType').then((response) => { + adviceTypeList.value = response.data + }) } -const SelectionList: Ref = ref([]) +getDict() + // 校验规则 const rules = ref({ - customerName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], - businessContent: [{ required: true, message: '业务内容不能为空', trigger: 'blur' }], - taxNumber: [{ required: true, message: '税号不能为空', trigger: 'blur' }], + customerName: [{ required: true, message: '公司名称不能为空', trigger: ['blur', 'change'] }], + advicePerson: [{ required: true, message: '投诉人不能为空', trigger: ['blur', 'change'] }], + adviceClass: [{ required: true, message: '投诉/建议类型必选', trigger: ['blur', 'change'] }], + adviceTime: [{ required: true, message: '投诉/建议时间不能为空', trigger: ['blur', 'change'] }], + adviceType: [{ required: true, message: '投诉/建议类别必选', trigger: ['blur', 'change'] }], }) // 表单验证规则 // 初始化router const $router = useRouter() @@ -108,82 +93,59 @@ $router.back() } const getInfo = () => { - getCustomerDetail({ id: infoId.value }).then((res) => { - dataForm.value = res.data - companyAddress.value = [dataForm.value.companyCountry, dataForm.value.companyProvince, dataForm.value.companyCity, dataForm.value.companyArea, dataForm.value.companyAddress] - invoiceAddress.value = [dataForm.value.invoiceCountry, dataForm.value.invoiceProvince, dataForm.value.invoiceCity, dataForm.value.invoiceArea, dataForm.value.invoiceAddress] - }) -} -// 表格选中 -const handleSelectionChange = (e: customerPerson[]) => { - SelectionList.value = e -} - -// 公司地址变化后给对象赋值 -function companyAddressChange(addressObj: IAddress) { - dataForm.value.companyCountry = addressObj.country - dataForm.value.companyProvince = addressObj.province - dataForm.value.companyCity = addressObj.city - dataForm.value.companyArea = addressObj.area - dataForm.value.companyAddress = addressObj.address - dataForm.value.companyCountryName = addressObj.countryName - dataForm.value.companyProvinceName = addressObj.provinceName - dataForm.value.companyCityName = addressObj.cityName - dataForm.value.companyAreaName = addressObj.areaName -} - -function invoiceAddressChange(addressObj: IAddress) { - dataForm.value.invoiceCountry = addressObj.country - dataForm.value.invoiceProvince = addressObj.province - dataForm.value.invoiceCity = addressObj.city - dataForm.value.invoiceArea = addressObj.area - dataForm.value.invoiceAddress = addressObj.address - dataForm.value.invoiceCountryName = addressObj.countryName - dataForm.value.invoiceProvinceName = addressObj.provinceName - dataForm.value.invoiceCityName = addressObj.cityName - dataForm.value.invoiceAreaName = addressObj.areaName -} -// 点击增加行 -const addRow = () => { - // 检查上一行必填项 - if (checkPersonList()) { - setAllRowReadable() - customerPersonList.value.push({ ...addPersonObj }) - } -} -// 检查人员列表 -function checkPersonList() { - for (let index = 0; index < customerPersonList.value.length; index++) { - const item = customerPersonList.value[index] - for (const prop of columns.value) { - // 检查必填 - if (prop.required && !item[prop.value]) { - ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) - return false - } - // 验证正则 - if (prop.reg && typeof prop.reg === 'function') { - if (!prop.reg(item[prop.value])) { - ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) - return false - } - } + loading.value = true + getAdviceDetail({ id: infoId.value }).then((res) => { + res.data = { + id: '1597579843411234817', + adviceNo: 'ts202201022131', // 投诉编号 + adviceClass: '0', // 投诉类型 + adviceType: '1', // 投诉类别 + advicePerson: '张三', // 投诉人-名称 + personPhone: '87447', // 投诉人联系方式 + customerName: '特别大公司', // 公司名称 + adviceTime: '2022-12-25 23:58:00', + customerNo: '', // 客户编号 + customerId: '', // 客户id + content: '没人接电话', // 投诉内容 + handleStatus: '0', // 处置状态-0未处置,1已处置 + handleMessage: '', // 处置意见 } - } - return true + dataForm.value = res.data + loading.value = false + }) } -// 删除行 -const deleteList = () => { - customerPersonList.value = customerPersonList.value.filter((item: customerPerson) => { - return !SelectionList.value.includes(item) - }) +const tempCompanyList = ref([ + { customerId: '111', customerNo: '12312456', customerName: '京东', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '112', customerNo: '12312451', customerName: '阿里', businessSizeName: '0~10万', companySizeName: '大企业', gradeName: '一般', evaluationName: '重点客户' }, + { customerId: '113', customerNo: '12312452', customerName: '淘宝', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '114', customerNo: '12312453', customerName: '天猫', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '115', customerNo: '12312454', customerName: '203d', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, + { customerId: '116', customerNo: '12312456', customerName: '万达', businessSizeName: '0~10万', companySizeName: '小微企业', gradeName: '优质', evaluationName: '重点客户' }, +]) +// 查询公司列表 +const queryCompany = (queryString: string, cb: any) => { + // TODO: 远程查询符合要求的公司列表 + const results = queryString ? tempCompanyList.value.filter((item) => { item.customerName.includes(queryString) }) : tempCompanyList.value + cb(results) +} + +// 选中 +const handleCompanySelect = (select: Record) => { + const item = select as SimpleCompany + companyInfo.customerName = item.customerName + companyInfo.customerNo = item.customerNo + companyInfo.customerId = item.customerId + companyInfo.gradeName = item.gradeName + companyInfo.companySizeName = item.companySizeName + companyInfo.businessSizeName = item.businessSizeName + companyInfo.evaluationName = item.evaluationName } // 打印表单 const printObj = ref({ id: 'form', // 需要打印元素的id - popTitle: '客户详情', // 打印配置页上方的标题 - extraHead: '

客户详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 + popTitle: '投诉/建议详情', // 打印配置页上方的标题 + // extraHead: '

投诉/建议详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 preview: false, // 是否启动预览模式,默认是false standard: '', extarCss: '', @@ -203,109 +165,67 @@ type: 'warning', }, ).then(() => { - addCustomer(dataForm.value).then((res) => { - if (res.code === 200) { - dataForm.value.id = res.data.id - dataForm.value.customerNo = res.data.customerNo - ElMessage.success('已保存') - } - }) + if (dataForm.value.id) { + updateAdvice(dataForm.value).then((res) => { + if (res.code === 200) { + dataForm.value.id = res.data.id + dataForm.value.customerNo = res.data.customerNo + ElMessage.success('已保存') + $router.go(-1) + } + }) + } + else { + addAdvice(dataForm.value).then((res) => { + if (res.code === 200) { + dataForm.value.id = res.data.id + dataForm.value.customerNo = res.data.customerNo + ElMessage.success('已保存') + $router.go(-1) + } + }) + } }) } }) } - -// 提交表单 -function submitForm() { - if (dataForm.value.id) { - const params = { - id: dataForm.value.id, - formId: SCHEDULE.SUPPLIER_APPROVAL, // 表单id - } - addCustomer(params).then((res) => { - ElMessage.success('提交成功') - close() - }) - } - else { - ElMessage.info('请先保存再提交!') - } -} -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const fileRef = ref() // 文件上传input -const onFileChange = (event: any) => { - // 原生上传 - console.log(event.target.files) - if (event.target.files?.length !== 0) { - // 创建formdata对象 - const fd = new FormData() - fd.append('multipartFile', event.target.files[0]) - UploadFile(fd).then((res) => { - if (res.code === 200) { - dataForm.value.minioFileName = res.data[0] - // 重置当前验证 - ElMessage.success('文件上传成功') - } - else { - ElMessage.error(res.message) - } - }) - } -} -const upload = () => { - fileRef.value.click() -} -// 双击行显示输入框 -const dblclickRow = (row: customerPerson) => { - setAllRowReadable() - row.editable = true -} -// 将所有人员信息列表置为不可编辑状态 -function setAllRowReadable() { - for (const item of customerPersonList.value) { - item.editable = false - } -} // 非添加页面获取详情 if (pageType.value !== 'add') { getInfo() } +else { + dataForm.value.adviceTime = dayjs().format('YYYY-MM-DD HH:mm:ss') +} diff --git a/src/views/customer/advice/adviceList.vue b/src/views/customer/advice/adviceList.vue index 1ec03b1..0cd26dd 100644 --- a/src/views/customer/advice/adviceList.vue +++ b/src/views/customer/advice/adviceList.vue @@ -53,7 +53,7 @@ listQuery.value.endTime = timeRange.value[1] as string || '' getAdviceList(listQuery.value).then((response) => { // 模拟数据 - response.data.rows = [{ advicePerson: '张三', personPhone: '87447', createTime: '2023-01-02 08:25:35', adviceNo: '111111', content: '服务态度不好', businessScope: 'test1', evaluation: '1', evaluationName: '优质', customerName: '京东集团', customerNo: 'sygf202211290001', updateTime: '2023-01-10 09:56:57' }] + response.data.rows = [{ id: '1597579843411234817', advicePerson: '张三', personPhone: '87447', createTime: '2023-01-02 08:25:35', adviceNo: '111111', content: '服务态度不好', businessScope: 'test1', evaluation: '1', evaluationName: '优质', customerName: '京东集团', customerNo: 'sygf202211290001', updateTime: '2023-01-10 09:56:57' }] list.value = response.data.rows total.value = parseInt(response.data.total) loadingTable.value = false @@ -66,7 +66,7 @@ // 点击编辑/详情 const handleEdit = (row: IAdvice, pageType: 'edit' | 'detail') => { - $router.push(`/customerManage/${pageType}/${row.id}`) + $router.push(`/customerManage/advice/${pageType}/${row.id}`) } // 点击删除 const handleDelete = (index: string, row: IAdvice) => { @@ -147,7 +147,7 @@ } // 添加客户 const add = () => { - $router.push('/customerManage/add') + $router.push('/customerManage/advice/add') } // 导出 const exportAll = () => { @@ -243,11 +243,11 @@