You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
346 lines
9.2 KiB
346 lines
9.2 KiB
<template>
|
|
<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"
|
|
:rules="dataRule"
|
|
ref="dataForm"
|
|
@keyup.enter.native="dataFormSubmitHandle()"
|
|
: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-item prop="logo" label="Logo">
|
|
<el-upload
|
|
:headers="$getElUploadHeaders()"
|
|
class="item_width_1 avatar-uploader"
|
|
:action="uploadUlr"
|
|
:show-file-list="false"
|
|
:on-success="handleImgSuccess"
|
|
:before-upload="beforeImgUpload"
|
|
>
|
|
<img
|
|
v-if="dataForm.paAgency.logo"
|
|
:src="dataForm.paAgency.logo"
|
|
style="width: 70px; height: 70px"
|
|
class="function-icon"
|
|
/>
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
</el-upload>
|
|
</el-form-item>
|
|
<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="paAgency.level">
|
|
<el-select
|
|
v-model="dataForm.paAgency.level"
|
|
placeholder="请选择"
|
|
clearable
|
|
>
|
|
<el-option
|
|
v-for="item in zuzhijibieList"
|
|
:key="item.dictValue"
|
|
:label="item.dictName"
|
|
:value="item.dictValue"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
<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="paAgency.province">
|
|
<el-input
|
|
v-model="dataForm.paAgency.province"
|
|
placeholder="组织省份"
|
|
></el-input>
|
|
</el-form-item>
|
|
|
|
<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="paAgency.district">
|
|
<el-input
|
|
v-model="dataForm.paAgency.district"
|
|
placeholder="组织区域"
|
|
></el-input>
|
|
</el-form-item>
|
|
<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="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>
|
|
</el-form-item>
|
|
<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="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>
|
|
</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服务
|
|
export default {
|
|
data() {
|
|
return {
|
|
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadimg",
|
|
visible: false,
|
|
dataForm: {
|
|
id: "",
|
|
paAgency: {
|
|
logo: "",
|
|
agencyName: "",
|
|
areaCode: "",
|
|
city: "",
|
|
district: "",
|
|
level: "",
|
|
levelNum: "",
|
|
partybranchnum: "",
|
|
province: "",
|
|
validityTime: "",
|
|
},
|
|
paCustomer: {
|
|
customerName: "",
|
|
},
|
|
paUser: {
|
|
gender: "1",
|
|
phone: "",
|
|
realName: "",
|
|
idCard: "",
|
|
},
|
|
|
|
// xialazhushi1: '',
|
|
|
|
// zuzhijibie:''
|
|
},
|
|
zuzhijibieList: [
|
|
{
|
|
dictName: "社区级",
|
|
dictValue: "community",
|
|
},
|
|
{
|
|
dictName: "乡(镇、街道)级",
|
|
dictValue: "street",
|
|
},
|
|
{
|
|
dictName: "区县级",
|
|
dictValue: "district",
|
|
},
|
|
{
|
|
dictName: "市级",
|
|
dictValue: "city",
|
|
},
|
|
{
|
|
dictName: "省级",
|
|
dictValue: "province",
|
|
},
|
|
],
|
|
|
|
functionList: [],
|
|
};
|
|
},
|
|
components: {
|
|
CForm,
|
|
CDialog,
|
|
},
|
|
created() {
|
|
this.queryFunctionList();
|
|
},
|
|
computed: {
|
|
dataRule() {
|
|
return {
|
|
logo: [
|
|
{
|
|
required: false,
|
|
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;
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
},
|
|
beforeImgUpload(file) {
|
|
// const isPNG = file.type === 'image/png'
|
|
const isLt1M = file.size / 1024 / 1024 < 1;
|
|
|
|
// if (!isPNG) {
|
|
// this.$message.error('上传图片只能是 PNG 格式!')
|
|
// }
|
|
if (!isLt1M) {
|
|
this.$message.error("上传图片大小不能超过 1MB!");
|
|
}
|
|
// return isPNG && isLt1M
|
|
return isLt1M;
|
|
},
|
|
init() {
|
|
this.visible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs["dataForm"].resetFields();
|
|
if (this.dataForm.id) {
|
|
this.getInfo();
|
|
}
|
|
});
|
|
},
|
|
// 表单提交
|
|
dataFormSubmitHandle: debounce(
|
|
function () {
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
console.log(this.dataForm);
|
|
if (!valid) {
|
|
return false;
|
|
}
|
|
|
|
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);
|
|
}
|
|
this.$message({
|
|
message: this.$t("prompt.success"),
|
|
type: "success",
|
|
duration: 500,
|
|
onClose: () => {
|
|
this.visible = false;
|
|
this.$emit("refreshDataList");
|
|
},
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
});
|
|
},
|
|
1000,
|
|
{ leading: true, trailing: false }
|
|
),
|
|
},
|
|
};
|
|
</script>
|
|
|