|
|
@ -1,41 +1,24 @@ |
|
|
|
<template> |
|
|
|
<el-dialog :visible.sync="visible" |
|
|
|
<el-dialog |
|
|
|
:visible.sync="visible" |
|
|
|
:title="!dataForm.id ? $t('add') : $t('update')" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-press-escape="false"> |
|
|
|
<el-form :model="dataForm" |
|
|
|
:close-on-press-escape="false" |
|
|
|
> |
|
|
|
<el-form |
|
|
|
:model="dataForm" |
|
|
|
:rules="dataRule" |
|
|
|
ref="dataForm" |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
:label-width="$i18n.locale === 'en-US' ? '120px' : '120px'"> |
|
|
|
<!-- <el-form-item label="功能" |
|
|
|
prop="xialazhushi1" |
|
|
|
v-if="true"> |
|
|
|
<el-select v-model="dataForm.xialazhushi1" |
|
|
|
placeholder="请选择" |
|
|
|
clearable> |
|
|
|
<el-option v-for="item in functionList" |
|
|
|
:key="item.id" |
|
|
|
:label="item.functionName" |
|
|
|
:value="item.id"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item>--> |
|
|
|
<el-form-item label="客户名称" |
|
|
|
prop="customerName"> |
|
|
|
<el-input v-model="dataForm.paCustomer.customerName" |
|
|
|
placeholder="客户名称"></el-input> |
|
|
|
:label-width="$i18n.locale === 'en-US' ? '120px' : '120px'" |
|
|
|
> |
|
|
|
<el-form-item label="客户名称" prop="paCustomer.customerName"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paCustomer.customerName" |
|
|
|
placeholder="客户名称" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form |
|
|
|
:inline="true" |
|
|
|
:model="dataForm" |
|
|
|
:rules="dataRule" |
|
|
|
ref="ref_form_2" |
|
|
|
style="margin: 0 auto; width: 860px" |
|
|
|
:label-width="'100px'" |
|
|
|
> |
|
|
|
<el-form-item prop="logo" label="Logo"> |
|
|
|
<el-upload |
|
|
|
:headers="$getElUploadHeaders()" |
|
|
@ -54,113 +37,131 @@ |
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form-item label="平台名称" |
|
|
|
prop="agencyName"> |
|
|
|
<el-input v-model="dataForm.paAgency.agencyName" |
|
|
|
placeholder="平台名称"></el-input> |
|
|
|
<el-form-item label="平台名称(根级组织名称)" prop="paAgency.agencyName"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paAgency.agencyName" |
|
|
|
placeholder="平台名称" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="组织级别" |
|
|
|
prop="level"> |
|
|
|
<el-select v-model="dataForm.paAgency.level" |
|
|
|
<el-form-item label="组织级别" prop="paAgency.level"> |
|
|
|
<el-select |
|
|
|
v-model="dataForm.paAgency.level" |
|
|
|
placeholder="请选择" |
|
|
|
clearable> |
|
|
|
<el-option v-for="item in zuzhijibieList" |
|
|
|
clearable |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in zuzhijibieList" |
|
|
|
:key="item.dictValue" |
|
|
|
:label="item.dictName" |
|
|
|
:value="item.dictValue"> |
|
|
|
:value="item.dictValue" |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="组织地区code" |
|
|
|
prop="areaCode"> |
|
|
|
<el-input v-model="dataForm.paAgency.areaCode" |
|
|
|
placeholder="组织地区code"></el-input> |
|
|
|
<el-form-item label="组织地区code" prop="paAgency.areaCode"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paAgency.areaCode" |
|
|
|
placeholder="组织地区code" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="组织省份" |
|
|
|
prop="province"> |
|
|
|
<el-input v-model="dataForm.paAgency.province" |
|
|
|
placeholder="组织省份"></el-input> |
|
|
|
<el-form-item label="组织省份" prop="paAgency.province"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paAgency.province" |
|
|
|
placeholder="组织省份" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="组织城市" |
|
|
|
prop="city"> |
|
|
|
<el-input v-model="dataForm.paAgency.city" |
|
|
|
placeholder="组织城市"></el-input> |
|
|
|
<el-form-item label="组织城市" prop="paAgency.city"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paAgency.city" |
|
|
|
placeholder="组织城市" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="组织区域" |
|
|
|
prop="district"> |
|
|
|
<el-input v-model="dataForm.paAgency.district" |
|
|
|
placeholder="组织区域"></el-input> |
|
|
|
<el-form-item label="组织区域" prop="paAgency.district"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paAgency.district" |
|
|
|
placeholder="组织区域" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="最大网格数" |
|
|
|
prop="partybranchnum"> |
|
|
|
<el-input-number v-model="dataForm.paAgency.partybranchnum" |
|
|
|
placeholder="最大网格数"></el-input-number> |
|
|
|
<el-form-item label="最大网格数" prop="paAgency.partybranchnum"> |
|
|
|
<el-input-number |
|
|
|
v-model="dataForm.paAgency.partybranchnum" |
|
|
|
placeholder="最大网格数" |
|
|
|
></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="有效期" |
|
|
|
prop="validityTime"> |
|
|
|
<el-date-picker v-model="dataForm.paAgency.validityTime" |
|
|
|
<el-form-item label="有效期" prop="paAgency.validityTime"> |
|
|
|
<el-date-picker |
|
|
|
v-model="dataForm.paAgency.validityTime" |
|
|
|
type="datetime" |
|
|
|
format="yyyy 年 MM 月 dd 日" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
placeholder="有效期"></el-date-picker> |
|
|
|
placeholder="有效期" |
|
|
|
></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="超级管理员" |
|
|
|
prop="realName"> |
|
|
|
<el-input v-model="dataForm.paUser.realName" |
|
|
|
placeholder="超级管理员"></el-input> |
|
|
|
<el-form-item label="超级管理员" prop="paUser.realName"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paUser.realName" |
|
|
|
placeholder="超级管理员" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="联系方式" |
|
|
|
prop="realName"> |
|
|
|
<el-input v-model="dataForm.paUser.phone" |
|
|
|
placeholder="联系方式"></el-input> |
|
|
|
<el-form-item label="联系方式" prop="paUser.phone"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paUser.phone" |
|
|
|
placeholder="联系方式" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="证件号" prop="paUser.idCard"> |
|
|
|
<el-input |
|
|
|
v-model="dataForm.paUser.idCard" |
|
|
|
placeholder="证件号" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
<template slot="footer"> |
|
|
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
@click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|
|
|
<el-button @click="visible = false">{{ $t("cancel") }}</el-button> |
|
|
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ |
|
|
|
$t("confirm") |
|
|
|
}}</el-button> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import debounce from 'lodash/debounce' |
|
|
|
import CForm from '@c/CForm' |
|
|
|
import CDialog from '@c/CDialog' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
import debounce from "lodash/debounce"; |
|
|
|
import CForm from "@c/CForm"; |
|
|
|
import CDialog from "@c/CDialog"; |
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
import { Loading } from "element-ui"; // 引入Loading服务 |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadimg', |
|
|
|
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadimg", |
|
|
|
visible: false, |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
id: "", |
|
|
|
paAgency: { |
|
|
|
logo:'', |
|
|
|
agencyName: '', |
|
|
|
areaCode: '', |
|
|
|
city: '', |
|
|
|
district: '', |
|
|
|
level: '', |
|
|
|
levelNum: '', |
|
|
|
partybranchnum: '', |
|
|
|
province: '', |
|
|
|
validityTime:'' |
|
|
|
logo: "", |
|
|
|
agencyName: "", |
|
|
|
areaCode: "", |
|
|
|
city: "", |
|
|
|
district: "", |
|
|
|
level: "", |
|
|
|
levelNum: "", |
|
|
|
partybranchnum: "", |
|
|
|
province: "", |
|
|
|
validityTime: "", |
|
|
|
}, |
|
|
|
paCustomer: { |
|
|
|
customerName:'', |
|
|
|
customerName: "", |
|
|
|
}, |
|
|
|
paUser: { |
|
|
|
gender:'1', |
|
|
|
phone:'', |
|
|
|
realName:'' |
|
|
|
gender: "1", |
|
|
|
phone: "", |
|
|
|
realName: "", |
|
|
|
idCard: "", |
|
|
|
}, |
|
|
|
|
|
|
|
// xialazhushi1: '', |
|
|
@ -169,107 +170,182 @@ export default { |
|
|
|
}, |
|
|
|
zuzhijibieList: [ |
|
|
|
{ |
|
|
|
'dictName': '社区级', |
|
|
|
'dictValue': 'community' |
|
|
|
}, { |
|
|
|
'dictName': '乡(镇、街道)级', |
|
|
|
'dictValue': 'street' |
|
|
|
}, { |
|
|
|
'dictName': '区县级', |
|
|
|
'dictValue': 'district' |
|
|
|
}, { |
|
|
|
'dictName': '市级', |
|
|
|
'dictValue': 'city' |
|
|
|
}, { |
|
|
|
'dictName': '省级', |
|
|
|
'dictValue': 'province' |
|
|
|
} |
|
|
|
dictName: "社区级", |
|
|
|
dictValue: "community", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictName: "乡(镇、街道)级", |
|
|
|
dictValue: "street", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictName: "区县级", |
|
|
|
dictValue: "district", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictName: "市级", |
|
|
|
dictValue: "city", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictName: "省级", |
|
|
|
dictValue: "province", |
|
|
|
}, |
|
|
|
], |
|
|
|
|
|
|
|
functionList: [] |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
functionList: [], |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: { |
|
|
|
CForm, |
|
|
|
CDialog |
|
|
|
CDialog, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.queryFunctionList() |
|
|
|
this.queryFunctionList(); |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
dataRule() { |
|
|
|
return { |
|
|
|
/* agencyName: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
],*/ |
|
|
|
logo: [ |
|
|
|
{ |
|
|
|
required: false, |
|
|
|
message: this.$t('validate.required'), |
|
|
|
trigger: 'blur' |
|
|
|
message: this.$t("validate.required"), |
|
|
|
trigger: "blur", |
|
|
|
}, |
|
|
|
], |
|
|
|
"paCustomer.customerName": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "客户名称必填", |
|
|
|
trigger: "blue", |
|
|
|
}, |
|
|
|
], |
|
|
|
"paAgency.agencyName": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '根级组织名称必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
] |
|
|
|
], |
|
|
|
"paAgency.level": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '组织级别必填', |
|
|
|
trigger: 'change' |
|
|
|
} |
|
|
|
], |
|
|
|
"paAgency.areaCode": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '组织地区码必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
], |
|
|
|
"paAgency.province": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '组织省份必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
], |
|
|
|
"paUser.realName": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '管理员姓名必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
], |
|
|
|
"paUser.phone": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '管理员电话必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
], |
|
|
|
"paUser.idCard": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '管理员证件号必填', |
|
|
|
trigger: 'blue' |
|
|
|
} |
|
|
|
], |
|
|
|
"paAgency.validityTime": [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '必填', |
|
|
|
trigger: 'change' |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 上传logo成功 |
|
|
|
handleImgSuccess(res, file) { |
|
|
|
console.log("!") |
|
|
|
if (res.code === 0 && res.msg === 'success') { |
|
|
|
console.log("!") |
|
|
|
this.dataForm.paAgency.logo = res.data.url |
|
|
|
console.log("!"); |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("!"); |
|
|
|
this.dataForm.paAgency.logo = res.data.url; |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg) |
|
|
|
this.$message.error(res.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeImgUpload(file) { |
|
|
|
// const isPNG = file.type === 'image/png' |
|
|
|
const isLt1M = file.size / 1024 / 1024 < 1 |
|
|
|
const isLt1M = file.size / 1024 / 1024 < 1; |
|
|
|
|
|
|
|
// if (!isPNG) { |
|
|
|
// this.$message.error('上传图片只能是 PNG 格式!') |
|
|
|
// } |
|
|
|
if (!isLt1M) { |
|
|
|
this.$message.error('上传图片大小不能超过 1MB!') |
|
|
|
this.$message.error("上传图片大小不能超过 1MB!"); |
|
|
|
} |
|
|
|
// return isPNG && isLt1M |
|
|
|
return isLt1M |
|
|
|
return isLt1M; |
|
|
|
}, |
|
|
|
init() { |
|
|
|
this.visible = true |
|
|
|
this.visible = true; |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
this.$refs["dataForm"].resetFields(); |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
this.getInfo(); |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function() { |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
dataFormSubmitHandle: debounce( |
|
|
|
function () { |
|
|
|
this.$refs["dataForm"].validate((valid) => { |
|
|
|
console.log(this.dataForm); |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (true) { |
|
|
|
this.$message.info("成功"); |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log(this.dataForm) |
|
|
|
this.$http['post']('/oper/crm/customer/initLocally', this.dataForm).then(({ data: res }) => { |
|
|
|
|
|
|
|
console.log(this.dataForm); |
|
|
|
this.$http["post"]("/oper/crm/customer/initLocally", this.dataForm) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
return this.$message.error(res.msg); |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: this.$t('prompt.success'), |
|
|
|
type: 'success', |
|
|
|
message: this.$t("prompt.success"), |
|
|
|
type: "success", |
|
|
|
duration: 500, |
|
|
|
onClose: () => { |
|
|
|
this.visible = false |
|
|
|
this.$emit('refreshDataList') |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
this.visible = false; |
|
|
|
this.$emit("refreshDataList"); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }), |
|
|
|
} |
|
|
|
} |
|
|
|
.catch(() => {}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
1000, |
|
|
|
{ leading: true, trailing: false } |
|
|
|
), |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|