4 changed files with 312 additions and 16 deletions
@ -0,0 +1,275 @@ |
|||||
|
<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="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> |
||||
|
</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()" |
||||
|
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> |
||||
|
<el-form-item label="平台名称" |
||||
|
prop="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" |
||||
|
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="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> |
||||
|
|
||||
|
<el-form-item label="组织城市" |
||||
|
prop="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> |
||||
|
<el-form-item label="最大网格数" |
||||
|
prop="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" |
||||
|
type="datetime" |
||||
|
format="yyyy 年 MM 月 dd 日" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
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> |
||||
|
<el-form-item label="联系方式" |
||||
|
prop="realName"> |
||||
|
<el-input v-model="dataForm.paUser.phone" |
||||
|
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:'' |
||||
|
}, |
||||
|
|
||||
|
// 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 { |
||||
|
/* agencyName: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
],*/ |
||||
|
logo: [ |
||||
|
{ |
||||
|
required: false, |
||||
|
message: this.$t('validate.required'), |
||||
|
trigger: 'blur' |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
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) => { |
||||
|
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> |
Loading…
Reference in new issue