From 9bcab88b42c9acebaa689970ed7d1cf0bd0fa0a8 Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Thu, 26 Aug 2021 14:00:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AE=A1=E7=90=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../businessManagement/BusinessManagement.vue | 4 +- .../businessManagement/ContactManagement.vue | 43 +++++++++++------ .../modules/BusinessManagementModule.vue | 26 +++++++++- .../modules/ContactManagementModule.vue | 48 ++++++++++++++----- 4 files changed, 92 insertions(+), 29 deletions(-) diff --git a/src/views/businessManagement/BusinessManagement.vue b/src/views/businessManagement/BusinessManagement.vue index d4c084f..31e2078 100644 --- a/src/views/businessManagement/BusinessManagement.vue +++ b/src/views/businessManagement/BusinessManagement.vue @@ -40,7 +40,7 @@ bordered rowKey="id" :columns="columns" - :scroll="{x: 1100}" + :scroll="{x: 1300}" :dataSource="dataSource" :pagination="ipagination" :loading="loading" @@ -125,12 +125,12 @@ export default { }, { title: '公司地址', align: 'center', - width: 350, dataIndex: 'companyAddress', scopedSlots: { customRender: 'text' } }, { title: '公司电话', align: 'center', + width: 180, dataIndex: 'companyPhone' }, { title: '创建时间', diff --git a/src/views/businessManagement/ContactManagement.vue b/src/views/businessManagement/ContactManagement.vue index 246439d..afbc4c4 100644 --- a/src/views/businessManagement/ContactManagement.vue +++ b/src/views/businessManagement/ContactManagement.vue @@ -33,10 +33,12 @@
新增 - 导入 - 导出 - 下载模板 - 批量删除 + + 导入 + + 导出 + 下载模板 + 批量删除
@@ -65,8 +67,15 @@ + + @@ -91,6 +100,11 @@ export default { name: 'ContactManagement', components: { ContactManagementModule }, mixins: [JeroListMixin], + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, data() { return { labelCol: { @@ -102,12 +116,12 @@ export default { sm: { span: 10 } }, url: { - list: '', - delete: '', - deleteBatch: '', - exportXlsUrl: '', - importExcelUrl: '', - exportTemplateUrl: '' + list: '/company/payContactsManagement/list', + delete: '/company/payContactsManagement/delete', + deleteBatch: '/company/payContactsManagement/deleteBatch', + exportXlsUrl: '/company/payContactsManagement/exportXls', + importExcelUrl: '/company/payContactsManagement/importExcel', + downTemplateUrl: '' }, columns: [ { @@ -129,7 +143,8 @@ export default { title: '性别', align: 'center', width: 80, - dataIndex: 'gender' + dataIndex: 'gender', + scopedSlots: { customRender: 'sex' } }, { title: '职务', align: 'center', diff --git a/src/views/businessManagement/modules/BusinessManagementModule.vue b/src/views/businessManagement/modules/BusinessManagementModule.vue index a3df674..17ae876 100644 --- a/src/views/businessManagement/modules/BusinessManagementModule.vue +++ b/src/views/businessManagement/modules/BusinessManagementModule.vue @@ -104,6 +104,7 @@ import { postcode, phoneReg, isPhone } from '@/utils/validate' import pick from 'lodash.pick' import { httpAction } from '@api/manage' +import { duplicateCheck } from '@api/api' export default { name: 'BusinessMangementModule', @@ -133,7 +134,7 @@ export default { }, validatorRules: { companyName: { - rules: [{ required: true, message: '请输入企业名称' }], + rules: [{ required: true, validator: this.checkCompanyName }], validateTrigger: 'blur' }, companyPhone: { @@ -229,6 +230,29 @@ export default { return } callback() + }, + /** + * 企业名称唯一性校验 + * @param rules + * @param value + * @param callback + */ + checkCompanyName(rules, value, callback) { + if (value) { + const params = { + confusionCode: 'pay_company_management_company_name', + fieldVal: value + } + duplicateCheck(params).then(res => { + if (res.success) { + callback() + } else { + callback(res.message) + } + }) + } else { + callback('请输入企业名称') + } } } } diff --git a/src/views/businessManagement/modules/ContactManagementModule.vue b/src/views/businessManagement/modules/ContactManagementModule.vue index fb4dcd5..07c4548 100644 --- a/src/views/businessManagement/modules/ContactManagementModule.vue +++ b/src/views/businessManagement/modules/ContactManagementModule.vue @@ -13,7 +13,7 @@ @@ -31,10 +31,8 @@ - + @@ -104,6 +102,7 @@ import pick from 'lodash.pick' import { httpAction } from '@api/manage' import CompanySelect from '@comp/company/CompanySelect' import { postcode, phoneReg, isEmail } from '@/utils/validate' +import { duplicateCheck } from '@api/api' export default { name: 'ContactManagementModule', @@ -149,11 +148,11 @@ export default { sm: { span: 21 } }, url: { - add: '', - edit: '' + add: '/company/payContactsManagement/add', + edit: '/company/payContactsManagement/edit' }, validatorRules: { - companyName: { + company: { rules: [{ required: true, message: '请选择企业' }], validateTrigger: 'blur' }, @@ -189,16 +188,22 @@ export default { } this.model = Object.assign({}, company) this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'companyName')) + this.form.setFieldsValue(pick(this.model, 'company')) }) } }, edit(record) { + console.log(record, '-------edit') + let company = { + id: record.companyId, + companyName: record.companyName + } + record.company = company this.form.resetFields() this.model = Object.assign({}, record) this.visible = true this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'companyName', 'name', 'gender', 'post', 'phone', 'email', 'contactAddress', 'postalCode', 'remarks')) + this.form.setFieldsValue(pick(this.model, 'company', 'name', 'gender', 'post', 'phone', 'email', 'contactAddress', 'postalCode', 'remarks')) }) }, close() { @@ -210,6 +215,10 @@ export default { // 触发表单验证 this.form.validateFields((err, values) => { if (!err) { + // 处理企业名称和id等信息 + values.companyName = values.company.companyName + values.companyId = values.company.id + values.gender = Number(values.gender) let httpurl = '' let method = '' if (!this.model.id) { @@ -246,10 +255,25 @@ export default { */ checkPhone(rules, value, callback) { if (phoneReg(value)) { + if (!this.model.id) { + const param = { + confusionCode: 'pay_contacts_management_phone', + fieldVal: value + } + // 唯一性校验 + duplicateCheck(param).then(res => { + if (res.success) { + callback() + } else { + callback(res.message) + } + }) + return + } callback() - } else { - callback('请填写正确手机号') + return } + callback('请填写正确手机号') }, /** * 邮箱校验