企业管理模块接口对接

This commit is contained in:
zhaoxiao
2021-08-26 14:00:37 +08:00
parent 97c6342e10
commit 9bcab88b42
4 changed files with 92 additions and 29 deletions
@@ -40,7 +40,7 @@
bordered bordered
rowKey="id" rowKey="id"
:columns="columns" :columns="columns"
:scroll="{x: 1100}" :scroll="{x: 1300}"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
@@ -125,12 +125,12 @@ export default {
}, { }, {
title: '公司地址', title: '公司地址',
align: 'center', align: 'center',
width: 350,
dataIndex: 'companyAddress', dataIndex: 'companyAddress',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, { }, {
title: '公司电话', title: '公司电话',
align: 'center', align: 'center',
width: 180,
dataIndex: 'companyPhone' dataIndex: 'companyPhone'
}, { }, {
title: '创建时间', title: '创建时间',
@@ -33,10 +33,12 @@
<!-- 操作按钮区域--> <!-- 操作按钮区域-->
<div class="table-operator"> <div class="table-operator">
<a-button type="primary" icon="plus" @click="handleAdd">新增</a-button> <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
<a-button type="primary" icon="import">导入</a-button> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="export"></a-button> <a-button type="primary" icon="import"></a-button>
<a-button type="primary" icon="download">下载模板</a-button> </a-upload>
<a-button type="danger" icon="delete">批量删除</a-button> <a-button type="primary" icon="export" @click="handleExportXls('联系人管理')">导出</a-button>
<a-button type="primary" icon="download" @click="downTemplate('联系人管理导入模板')">下载模板</a-button>
<a-button type="danger" icon="delete" @click="batchDel">批量删除</a-button>
</div> </div>
<!-- 操作按钮区域-end--> <!-- 操作按钮区域-end-->
@@ -65,8 +67,15 @@
</template> </template>
<template slot="fileSlot" slot-scope="text,record"> <template slot="fileSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<j-ellipsis @click.native="uploadFile(record.chargeNoticeFileId)" style="color:#219AFF;cursor: pointer" <j-ellipsis
:value="text" :length="20"/> @click.native="uploadFile(record.chargeNoticeFileId)"
style="color:#219AFF;cursor: pointer"
:value="text"
:length="20"/>
</template>
<template slot="sex" slot-scope="text, record">
<div>{{ text === 1 ? '男' : text === 2 ? '女' : '' }}</div>
</template> </template>
<template slot="text" slot-scope="text,record"> <template slot="text" slot-scope="text,record">
@@ -79,7 +88,7 @@
</span> </span>
</a-table> </a-table>
</div> </div>
<contact-management-module ref="modalForm"></contact-management-module> <contact-management-module ref="modalForm" @ok="modalFormOk"></contact-management-module>
</a-card> </a-card>
</template> </template>
@@ -91,6 +100,11 @@ export default {
name: 'ContactManagement', name: 'ContactManagement',
components: { ContactManagementModule }, components: { ContactManagementModule },
mixins: [JeroListMixin], mixins: [JeroListMixin],
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
data() { data() {
return { return {
labelCol: { labelCol: {
@@ -102,12 +116,12 @@ export default {
sm: { span: 10 } sm: { span: 10 }
}, },
url: { url: {
list: '', list: '/company/payContactsManagement/list',
delete: '', delete: '/company/payContactsManagement/delete',
deleteBatch: '', deleteBatch: '/company/payContactsManagement/deleteBatch',
exportXlsUrl: '', exportXlsUrl: '/company/payContactsManagement/exportXls',
importExcelUrl: '', importExcelUrl: '/company/payContactsManagement/importExcel',
exportTemplateUrl: '' downTemplateUrl: ''
}, },
columns: [ columns: [
{ {
@@ -129,7 +143,8 @@ export default {
title: '性别', title: '性别',
align: 'center', align: 'center',
width: 80, width: 80,
dataIndex: 'gender' dataIndex: 'gender',
scopedSlots: { customRender: 'sex' }
}, { }, {
title: '职务', title: '职务',
align: 'center', align: 'center',
@@ -104,6 +104,7 @@
import { postcode, phoneReg, isPhone } from '@/utils/validate' import { postcode, phoneReg, isPhone } from '@/utils/validate'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { httpAction } from '@api/manage' import { httpAction } from '@api/manage'
import { duplicateCheck } from '@api/api'
export default { export default {
name: 'BusinessMangementModule', name: 'BusinessMangementModule',
@@ -133,7 +134,7 @@ export default {
}, },
validatorRules: { validatorRules: {
companyName: { companyName: {
rules: [{ required: true, message: '请输入企业名称' }], rules: [{ required: true, validator: this.checkCompanyName }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
companyPhone: { companyPhone: {
@@ -229,6 +230,29 @@ export default {
return return
} }
callback() 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('请输入企业名称')
}
} }
} }
} }
@@ -13,7 +13,7 @@
<a-col :xl="12" :sm="24"> <a-col :xl="12" :sm="24">
<a-form-item label="企业名称" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="企业名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<company-select placeholder="请选择企业" <company-select placeholder="请选择企业"
v-decorator="['companyName',validatorRules.companyName]" v-decorator="['company',validatorRules.company]"
:maxLength='50' :maxLength='50'
:is-company-disabled="isCompanyDisabled" :is-company-disabled="isCompanyDisabled"
:disabled="isCompanyDisabled"></company-select> :disabled="isCompanyDisabled"></company-select>
@@ -31,10 +31,8 @@
<a-row> <a-row>
<a-col :xl="12" :sm="24"> <a-col :xl="12" :sm="24">
<a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择性别" <j-dict-select-tag v-decorator="['gender', {}]" :triggerChange="true" placeholder="请选择性别"
v-decorator="['gender']" dictCode="pay_gender"/>
:maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="12" :sm="24"> <a-col :xl="12" :sm="24">
@@ -104,6 +102,7 @@ import pick from 'lodash.pick'
import { httpAction } from '@api/manage' import { httpAction } from '@api/manage'
import CompanySelect from '@comp/company/CompanySelect' import CompanySelect from '@comp/company/CompanySelect'
import { postcode, phoneReg, isEmail } from '@/utils/validate' import { postcode, phoneReg, isEmail } from '@/utils/validate'
import { duplicateCheck } from '@api/api'
export default { export default {
name: 'ContactManagementModule', name: 'ContactManagementModule',
@@ -149,11 +148,11 @@ export default {
sm: { span: 21 } sm: { span: 21 }
}, },
url: { url: {
add: '', add: '/company/payContactsManagement/add',
edit: '' edit: '/company/payContactsManagement/edit'
}, },
validatorRules: { validatorRules: {
companyName: { company: {
rules: [{ required: true, message: '请选择企业' }], rules: [{ required: true, message: '请选择企业' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
@@ -189,16 +188,22 @@ export default {
} }
this.model = Object.assign({}, company) this.model = Object.assign({}, company)
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'companyName')) this.form.setFieldsValue(pick(this.model, 'company'))
}) })
} }
}, },
edit(record) { edit(record) {
console.log(record, '-------edit')
let company = {
id: record.companyId,
companyName: record.companyName
}
record.company = company
this.form.resetFields() this.form.resetFields()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { 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() { close() {
@@ -210,6 +215,10 @@ export default {
// 触发表单验证 // 触发表单验证
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
// 处理企业名称和id等信息
values.companyName = values.company.companyName
values.companyId = values.company.id
values.gender = Number(values.gender)
let httpurl = '' let httpurl = ''
let method = '' let method = ''
if (!this.model.id) { if (!this.model.id) {
@@ -246,10 +255,25 @@ export default {
*/ */
checkPhone(rules, value, callback) { checkPhone(rules, value, callback) {
if (phoneReg(value)) { 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() callback()
} else { return
callback('请填写正确手机号')
} }
callback('请填写正确手机号')
}, },
/** /**
* 邮箱校验 * 邮箱校验