Commit b8aa36f0 by yangming

商户

1 parent 56794448
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录密码" prop="merchantLoginPassword"> <el-form-item label="登录密码" prop="merchantLoginPassword">
<el-input maxlength="15" :disabled="nextStatus" size="small" type="password" v-model="accountInfoForm.merchantLoginPassword" placeholder="请输入登录密码"></el-input> <el-input maxlength="20" :disabled="nextStatus" size="small" type="password" v-model="accountInfoForm.merchantLoginPassword" placeholder="请输入登录密码(必须包含6-20个字母+数字)" show-password></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -109,6 +109,13 @@ export default { ...@@ -109,6 +109,13 @@ export default {
callback() callback()
} }
} }
const validatePwd = (rule, value, callback) => {
if (!(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(value))) {
callback(new Error('请输入正确的6-20个字母+数字密码'))
} else {
callback()
}
}
return { return {
nextStatus: false, nextStatus: false,
accountTypesRule: false, accountTypesRule: false,
...@@ -153,7 +160,8 @@ export default { ...@@ -153,7 +160,8 @@ export default {
], ],
merchantLoginPassword: [ merchantLoginPassword: [
{ required: true, message: '请输入登录密码', trigger: 'blur' }, { required: true, message: '请输入登录密码', trigger: 'blur' },
{ min: 6, max: 15, message: '长度在 6 到 15 个字符', trigger: 'blur' } { min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' },
{ validator: validatePwd, trigger: 'blur' }
] ]
} }
} }
......
...@@ -4,123 +4,51 @@ ...@@ -4,123 +4,51 @@
<div class="el-tabs__header is-top"> <div class="el-tabs__header is-top">
<div class="el-tabs__nav-wrap is-top"> <div class="el-tabs__nav-wrap is-top">
<div class="el-tabs__nav-scroll"> <div class="el-tabs__nav-scroll">
<div <div role="tablist" class="el-tabs__nav is-top" style="transform: translateX(0px)">
role="tablist" <div class="el-tabs__active-bar is-top" :style="{ width: '84px', transform: 'translateX(' + tabWidth + 'px)' }"></div>
class="el-tabs__nav is-top" <div @click="hanleTab(1)" id="tab-first" aria-controls="pane-first" role="tab" aria-selected="true" tabindex="0" class="el-tabs__item is-top" :class="{ 'is-active': step == 'first' }">修改功能权限</div>
style="transform: translateX(0px)" <div @click="hanleTab(2)" id="tab-second" aria-controls="pane-second" role="tab" tabindex="-1" class="el-tabs__item is-top" :class="{ 'is-active': step == 'second' }">修改基本信息</div>
>
<div
class="el-tabs__active-bar is-top"
:style="{ width: '84px', transform: 'translateX(' + tabWidth + 'px)' }"
></div>
<div
@click="hanleTab(1)"
id="tab-first"
aria-controls="pane-first"
role="tab"
aria-selected="true"
tabindex="0"
class="el-tabs__item is-top"
:class="{ 'is-active': step == 'first' }"
>
修改功能权限
</div>
<div
@click="hanleTab(2)"
id="tab-second"
aria-controls="pane-second"
role="tab"
tabindex="-1"
class="el-tabs__item is-top"
:class="{ 'is-active': step == 'second' }"
>
修改基本信息
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="el-tabs__content"> <div class="el-tabs__content">
<div <div data-v-db55ad92="" role="tabpanel" id="pane-first" aria-labelledby="tab-first" class="el-tab-pane"></div>
data-v-db55ad92="" <div data-v-db55ad92="" role="tabpanel" aria-hidden="true" id="pane-second" aria-labelledby="tab-second" class="el-tab-pane" style="display: none"></div>
role="tabpanel"
id="pane-first"
aria-labelledby="tab-first"
class="el-tab-pane"
></div>
<div
data-v-db55ad92=""
role="tabpanel"
aria-hidden="true"
id="pane-second"
aria-labelledby="tab-second"
class="el-tab-pane"
style="display: none"
></div>
</div> </div>
</div> </div>
<div v-show="step == 'second'"> <div v-show="step == 'second'">
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">修改账户信息</div> <div class="form-title">修改账户信息</div>
<el-form <el-form ref="accountInfoForm" :model="accountInfoForm" class="account-body-form" label-width="120px" :rules="accountInfoRules">
ref="accountInfoForm"
:model="accountInfoForm"
class="account-body-form"
label-width="120px"
:rules="accountInfoRules"
>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录账户名" prop="merchantLoginAccount"> <el-form-item label="登录账户名" prop="merchantLoginAccount">
<el-input <el-input readonly size="small" v-model="accountInfoForm.merchantLoginAccount" placeholder="请输入登录账户名"></el-input>
readonly
size="small"
v-model="accountInfoForm.merchantLoginAccount"
placeholder="请输入登录账户名"
>
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item size="small" label="登录密码" prop="merchantLoginPassword" class="form-row">
size="small" <el-input type="password" :readonly="pwdStatus ? 'readonly' : false" v-model="accountInfoForm.merchantLoginPassword" placeholder="请输入登录密码(必须包含6-20个字母+数字)" show-password></el-input>
label="登录密码"
prop="merchantLoginPassword"
class="form-row"
>
<el-input
type="password"
:readonly="pwdStatus ? 'readonly' : false"
v-model="accountInfoForm.merchantLoginPassword"
placeholder="请输入登录密码"
></el-input>
<el-button <el-button
type="primary" type="primary"
class="form-btn" class="form-btn"
@click=" @click="
pwdStatus = false; pwdStatus = false
accountInfoForm.merchantLoginPassword = ''; accountInfoForm.merchantLoginPassword = ''
" "
>重置密码</el-button
> >
重置密码
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="16"> <el-col :span="16">
<el-form-item label="账户类型"> <el-form-item label="账户类型">
<auto-button <auto-button v-for="(item, index) in accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" stopClick="true" :typeStatus="accounttypeId.indexOf(item.accounttypeId) == -1 ? true : false"></auto-button>
v-for="(item, index) in accountTypes"
:key="index"
:btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId"
stopClick="true"
:typeStatus="
accounttypeId.indexOf(item.accounttypeId) == -1 ? true : false
"
></auto-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -128,13 +56,7 @@ ...@@ -128,13 +56,7 @@
</div> </div>
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">修改企业信息</div> <div class="form-title">修改企业信息</div>
<base-info <base-info ref="baseInfoForm" :brandData="brandData" :accountAddForm="accountAddForm" :businessScopeCustomize="businessScopeCustomize" :businessOption="businessOption"></base-info>
ref="baseInfoForm"
:brandData="brandData"
:accountAddForm="accountAddForm"
:businessScopeCustomize="businessScopeCustomize"
:businessOption="businessOption"
></base-info>
</div> </div>
</div> </div>
<div v-show="step == 'first'"> <div v-show="step == 'first'">
...@@ -144,15 +66,11 @@ ...@@ -144,15 +66,11 @@
class="footer-panel" class="footer-panel"
:style="{ :style="{
left: footerLeft + 'px', left: footerLeft + 'px',
width: footerWidth + 'px', width: footerWidth + 'px'
}" }"
> >
<el-button type="primary" @click="handleSave()" v-show="step == 'first'" <el-button type="primary" @click="handleSave()" v-show="step == 'first'">确定</el-button>
>确定</el-button <el-button type="primary" @click="handleNext()" v-show="step == 'second'">确定</el-button>
>
<el-button type="primary" @click="handleNext()" v-show="step == 'second'"
>确定</el-button
>
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<el-dialog :visible.sync="dialogMapVisible" width="60%"> <el-dialog :visible.sync="dialogMapVisible" width="60%">
...@@ -166,39 +84,46 @@ ...@@ -166,39 +84,46 @@
</template> </template>
<script> <script>
import util from "@/utils/util"; import util from '@/utils/util'
import mapView from "@/components/mapView/index"; import mapView from '@/components/mapView/index'
import autoButton from "@/components/auto-button/index"; import autoButton from '@/components/auto-button/index'
import selectProduct from "./components/selectProduct"; import selectProduct from './components/selectProduct'
import baseInfo from "./components/baseInfo"; import baseInfo from './components/baseInfo'
export default { export default {
name: "index", name: 'index',
components: { components: {
mapView, mapView,
autoButton, autoButton,
selectProduct, selectProduct,
baseInfo, baseInfo
}, },
data() { data() {
const validatePwd = (rule, value, callback) => {
if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(value)) {
callback(new Error('请输入正确的6-20个字母+数字密码'))
} else {
callback()
}
}
return { return {
editStatus: false, editStatus: false,
detailFirst: {}, detailFirst: {},
tabWidth: 0, tabWidth: 0,
editInfo: {}, editInfo: {},
pwdStatus: true, pwdStatus: true,
step: "first", step: 'first',
filterText: "", filterText: '',
brandData: [], brandData: [],
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label'
}, },
parentId: "1", parentId: '1',
mapHeight: 400, mapHeight: 400,
typeStatus: false, typeStatus: false,
loadingImg: false, loadingImg: false,
dialogMapVisible: false, dialogMapVisible: false,
businessScopeCustomize: [{ name: "" }], businessScopeCustomize: [{ name: '' }],
accountAddForm: { accountAddForm: {
id: null, id: null,
isloginName: null, isloginName: null,
...@@ -218,12 +143,12 @@ export default { ...@@ -218,12 +143,12 @@ export default {
merchantModel: null, merchantModel: null,
businessScope: [], businessScope: [],
bussinessTime: [], bussinessTime: [],
merchantFiles: [], merchantFiles: []
}, },
accounttypeId: [], accounttypeId: [],
accountInfoForm: { accountInfoForm: {
merchantLoginAccount: "", merchantLoginAccount: '',
merchantLoginPassword: "", merchantLoginPassword: ''
}, },
accountTypes: [], accountTypes: [],
accountLevel: [], accountLevel: [],
...@@ -231,281 +156,236 @@ export default { ...@@ -231,281 +156,236 @@ export default {
businessOption: [], businessOption: [],
accountValidityPeriod: [], accountValidityPeriod: [],
baseRules: { baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }], merchantName: [{ required: true, message: '请输入商户名称', trigger: 'blur' }],
merchantLegalPersonPhone: [ merchantLegalPersonPhone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }]
{ required: true, message: "请输入联系电话", trigger: "blur" },
],
}, },
accountInfoRules: { accountInfoRules: {
merchantLoginAccount: [ merchantLoginAccount: [{ required: true, message: '请输入登录账户名', trigger: 'blur' }],
{ required: true, message: "请输入登录账户名", trigger: "blur" },
],
merchantLoginPassword: [ merchantLoginPassword: [
{ required: true, message: "请输入登录密码", trigger: "blur" }, { required: true, message: '请输入登录密码', trigger: 'blur' },
{ min: 6, max: 15, message: "长度在 6 到 15 个字符", trigger: "blur" }, { min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' },
], { validator: validatePwd, trigger: 'blur' }
}, ]
}; }
}
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.brandTree.filter(val); this.$refs.brandTree.filter(val)
}, },
accountAddForm: { accountAddForm: {
handler() { handler() {
this.editStatus = true; this.editStatus = true
}, },
deep: true, deep: true
}, },
accountInfoForm: { accountInfoForm: {
handler() { handler() {
this.editStatus = true; this.editStatus = true
},
deep: true,
}, },
deep: true
}
}, },
methods: { methods: {
hanleTab(status) { hanleTab(status) {
if (this.editStatus) { if (this.editStatus) {
this.$confirm("是否保存修改信息?", "提示", { this.$confirm('是否保存修改信息?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning'
}) })
.then(() => { .then(() => {
status == 1? this.handleNext(status):this.handleSave(status); status == 1 ? this.handleNext(status) : this.handleSave(status)
}) })
.catch(() => { .catch(() => {
this.tabCancel(status); this.tabCancel(status)
}); })
} else { } else {
this.handleTabs(status); this.handleTabs(status)
} }
}, },
tabCancel(status) { tabCancel(status) {
if (status == 2) { if (status == 2) {
this.$refs.productForm.resetView(); this.$refs.productForm.resetView()
} else { } else {
this.renderView(this.detailFirst); this.renderView(this.detailFirst)
this.pwdStatus = true; this.pwdStatus = true
} }
this.handleTabs(status); this.handleTabs(status)
}, },
handleTabs(status) { handleTabs(status) {
this.editStatus = false; this.editStatus = false
if (status == 1 && this.step == "second") { if (status == 1 && this.step == 'second') {
this.tabWidth = 0; this.tabWidth = 0
this.step = "first"; this.step = 'first'
} }
if (status == 2 && this.step == "first") { if (status == 2 && this.step == 'first') {
this.step = "second"; this.step = 'second'
this.tabWidth = 124; this.tabWidth = 124
} }
}, },
handleCancel() { handleCancel() {
this.$router.push("/account/index"); this.$router.push('/account/index')
}, },
//保存 //保存
handleSave(status) { handleSave(status) {
let product = this.$refs.productForm.getSelectInfo(); let product = this.$refs.productForm.getSelectInfo()
if (product && product.every((item) => item.products.length == 0)) { if (product && product.every(item => item.products.length == 0)) {
this.$message.error("请选择产品"); this.$message.error('请选择产品')
return; return
} }
let accountTypes = JSON.stringify(this.$refs.productForm.getSelectInfo()); let accountTypes = JSON.stringify(this.$refs.productForm.getSelectInfo())
let params = { let params = {
accountTypes, accountTypes,
status: 2, status: 2,
merchantId: this.accountAddForm.id, merchantId: this.accountAddForm.id
}; }
this.$apis.store.updatePermissions(params).then((res) => { this.$apis.store.updatePermissions(params).then(res => {
if (res) { if (res) {
status ? this.handleTabs(status) : this.$router.push("/account/index"); status ? this.handleTabs(status) : this.$router.push('/account/index')
} }
}); })
}, },
//下一步 //下一步
handleNext(status) { handleNext(status) {
const pm1 = new Promise((resolve, reject) => { const pm1 = new Promise((resolve, reject) => {
this.$refs.baseInfoForm.$refs.baseForm.validate((valid) => { this.$refs.baseInfoForm.$refs.baseForm.validate(valid => {
if (valid) resolve(); if (valid) resolve()
setTimeout(() => { setTimeout(() => {
var isError = document.getElementsByClassName("is-error"); var isError = document.getElementsByClassName('is-error')
isError[0].querySelector("input").focus(); isError[0].querySelector('input').focus()
}, 100); }, 100)
}); })
}); })
const pm2 = new Promise((resolve, reject) => { const pm2 = new Promise((resolve, reject) => {
this.$refs.accountInfoForm.validate((valid) => { this.$refs.accountInfoForm.validate(valid => {
if (valid) resolve(); if (valid) resolve()
setTimeout(() => { setTimeout(() => {
var isError = document.getElementsByClassName("is-error"); var isError = document.getElementsByClassName('is-error')
isError[0].querySelector("input").focus(); isError[0].querySelector('input').focus()
}, 100); }, 100)
}); })
}); })
if ( if (this.accountAddForm.merchantType == 1 && this.accountAddForm.merchantOrgcode && !util.checkIdCard(this.accountAddForm.merchantOrgcode)) {
this.accountAddForm.merchantType == 1 && this.$message.error('请输入正确的身份证号码')
this.accountAddForm.merchantOrgcode && document.querySelector('#app').scrollTop = 0
!util.checkIdCard(this.accountAddForm.merchantOrgcode)
) {
this.$message.error("请输入正确的身份证号码");
document.querySelector("#app").scrollTop = 0;
setTimeout(() => { setTimeout(() => {
var isError = document.getElementsByClassName("card-input"); var isError = document.getElementsByClassName('card-input')
isError[0].querySelectorAll(".el-input__inner")[1].focus(); isError[0].querySelectorAll('.el-input__inner')[1].focus()
}, 100); }, 100)
return; return
} }
if ( if (this.accountAddForm.residentPhone && !util.checkPhone(this.accountAddForm.residentPhone)) {
this.accountAddForm.residentPhone && this.$message.error('请输入正确的驻店电话')
!util.checkPhone(this.accountAddForm.residentPhone) document.querySelector('#app').scrollTop = 0
) {
this.$message.error("请输入正确的驻店电话");
document.querySelector("#app").scrollTop = 0;
setTimeout(() => { setTimeout(() => {
var isError = document.getElementsByClassName("phone-input"); var isError = document.getElementsByClassName('phone-input')
isError[0].querySelector("input").focus(); isError[0].querySelector('input').focus()
}, 100); }, 100)
return; return
} }
let params = Object.assign({}, this.accountAddForm, this.accountInfoForm); let params = Object.assign({}, this.accountAddForm, this.accountInfoForm)
if (params.bussinessTime) { if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0]; params.bussinessBegintime = params.bussinessTime[0]
params.bussinessEndtime = params.bussinessTime[1]; params.bussinessEndtime = params.bussinessTime[1]
} else { } else {
params.bussinessBegintime = ""; params.bussinessBegintime = ''
params.bussinessEndtime = ""; params.bussinessEndtime = ''
} }
if (params.businessScope) { if (params.businessScope) {
params.businessScope = params.businessScope.join(","); params.businessScope = params.businessScope.join(',')
} }
params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree.getCheckedKeys().join(',')
.getCheckedKeys() params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0)
.join(","); let businessScopeCustomize = this.businessScopeCustomize.map(item => item.name)
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0); params.businessScopeCustomize = businessScopeCustomize.join(',')
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name); params.merchantFiles = JSON.stringify(params.merchantFiles)
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles);
Promise.all([pm1, pm2]).then(() => { Promise.all([pm1, pm2]).then(() => {
this.$apis.store.updateMerchant(params).then((res) => { this.$apis.store.updateMerchant(params).then(res => {
if (res) { if (res) {
status ? this.handleTabs(status) : this.$router.push("/account/index"); status ? this.handleTabs(status) : this.$router.push('/account/index')
} }
}); })
}); })
}, },
async findAllDictData() { async findAllDictData() {
let accountLevel = this.$apis.store.findAllDictData({ dictType: "account_level" }); let accountLevel = this.$apis.store.findAllDictData({ dictType: 'account_level' })
let accountType = this.$apis.store.findAllDictData({ dictType: "account_type" }); let accountType = this.$apis.store.findAllDictData({ dictType: 'account_type' })
let businessOption = this.$apis.store.findAllDictData({ let businessOption = this.$apis.store.findAllDictData({
dictType: "business_scope", dictType: 'business_scope'
}); })
await Promise.all([accountLevel, accountType, businessOption]).then((res) => { await Promise.all([accountLevel, accountType, businessOption]).then(res => {
[this.accountLevel, this.accountType, this.businessOption] = res; ;[this.accountLevel, this.accountType, this.businessOption] = res
}); })
this.findMerchantDetail(); this.findMerchantDetail()
}, },
async findMerchantDetail() { async findMerchantDetail() {
this.$apis.store this.$apis.store
.findMerchantDetail({ .findMerchantDetail({
id: this.accountAddForm.id, id: this.accountAddForm.id
}) })
.then((res) => { .then(res => {
let para; let para
if (res.parentMerchant) { if (res.parentMerchant) {
para = { para = {
id: this.accountAddForm.id, id: this.accountAddForm.id,
parentId: res.parentId, parentId: res.parentId,
accountlevel: res.merchantAccountLevel, accountlevel: res.merchantAccountLevel
}; }
} else { } else {
para = { para = {
ids: res.accountType, ids: res.accountType,
merchantId: res.id, merchantId: res.id,
accountlevel: res.merchantAccountLevel, accountlevel: res.merchantAccountLevel
}; }
} }
this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant); this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant)
this.detailFirst = util.deepClone(res); this.detailFirst = util.deepClone(res)
this.renderView(res); this.renderView(res)
}); })
}, },
renderView(res) { renderView(res) {
let { let { isloginName, bussinessBegintime, bussinessEndtime, lat, lng, merchantAddress, merchantName, merchantAbbreviation, merchantType, merchantOrgcode, merchantLegalPerson, merchantLegalPersonPhone, residentContact, residentPhone, merchantLoginAccount, merchantLoginPassword, merchantAccountLevel, businessScope, businessScopeCustomize, merchantBrand, merchantFileResponses, merchantModel, accountTypes, accountType, accounttypeId, channelId, status, parentId } = res
isloginName, this.accountInfoForm.merchantLoginAccount = merchantLoginAccount
bussinessBegintime, this.accountInfoForm.merchantLoginPassword = merchantLoginPassword
bussinessEndtime, this.accountTypes = accountTypes
lat, this.accountAddForm.businessScope = businessScope ? businessScope.split(',') : []
lng,
merchantAddress,
merchantName,
merchantAbbreviation,
merchantType,
merchantOrgcode,
merchantLegalPerson,
merchantLegalPersonPhone,
residentContact,
residentPhone,
merchantLoginAccount,
merchantLoginPassword,
merchantAccountLevel,
businessScope,
businessScopeCustomize,
merchantBrand,
merchantFileResponses,
merchantModel,
accountTypes,
accountType,
accounttypeId,
channelId,
status,
parentId,
} = res;
this.accountInfoForm.merchantLoginAccount = merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = merchantLoginPassword;
this.accountTypes = accountTypes;
this.accountAddForm.businessScope = businessScope ? businessScope.split(",") : [];
if (this.accountAddForm.businessScope.length > 0) { if (this.accountAddForm.businessScope.length > 0) {
for (let i in this.accountAddForm.businessScope) { for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt( this.accountAddForm.businessScope[i] = parseInt(this.accountAddForm.businessScope[i])
this.accountAddForm.businessScope[i]
);
} }
} }
this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime]; this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime]
businessScopeCustomize = businessScopeCustomize businessScopeCustomize = businessScopeCustomize ? businessScopeCustomize.split(',') : []
? businessScopeCustomize.split(",")
: [];
if (businessScopeCustomize.length > 0) { if (businessScopeCustomize.length > 0) {
this.businessScopeCustomize = businessScopeCustomize.map((item) => { this.businessScopeCustomize = businessScopeCustomize.map(item => {
return { return {
name: item, name: item
}; }
}); })
}else { } else {
this.businessScopeCustomize = [{name:''}]; this.businessScopeCustomize = [{ name: '' }]
} }
this.accounttypeId = accountType ? accountType.split(",") : []; this.accounttypeId = accountType ? accountType.split(',') : []
if (this.accounttypeId.length > 0) { if (this.accounttypeId.length > 0) {
this.accounttypeId = this.accounttypeId.map((item) => { this.accounttypeId = this.accounttypeId.map(item => {
return { return {
name: item, name: item
}; }
}); })
} }
if (merchantFileResponses.length > 0) { if (merchantFileResponses.length > 0) {
this.accountAddForm.merchantFiles = merchantFileResponses.map((item) => { this.accountAddForm.merchantFiles = merchantFileResponses.map(item => {
return { return {
fileUrl: item.fileUrl, fileUrl: item.fileUrl
}; }
}); })
} }
merchantBrand = merchantBrand ? merchantBrand.split(",") : []; merchantBrand = merchantBrand ? merchantBrand.split(',') : []
for (let i in merchantBrand) { for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]); merchantBrand[i] = parseInt(merchantBrand[i])
} }
this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand); this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand)
this.accountAddForm = Object.assign(this.accountAddForm, { this.accountAddForm = Object.assign(this.accountAddForm, {
isloginName: isloginName ? true : false, isloginName: isloginName ? true : false,
lat, lat,
...@@ -524,29 +404,28 @@ export default { ...@@ -524,29 +404,28 @@ export default {
parentId, parentId,
channelId, channelId,
status, status,
accounttypeId: accountType, accounttypeId: accountType
}); })
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.baseInfoForm.$refs.baseForm.validate()
this.$refs.baseInfoForm.$refs.baseForm.validate(); this.editStatus = false
this.editStatus = false; })
});
}, },
getCarbrandTree() { getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => { this.$apis.store.getCarbrandTree({}).then(res => {
this.brandData = res; this.brandData = res
}); })
}, }
}, },
mounted() { mounted() {
document.querySelector("#app").scrollTop = 0; document.querySelector('#app').scrollTop = 0
this.footerLeft = document.querySelector(".base-container-right").offsetLeft; this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft; this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.accountAddForm.id = this.$route.params.id; this.accountAddForm.id = this.$route.params.id
this.getCarbrandTree(); this.getCarbrandTree()
this.findAllDictData(); this.findAllDictData()
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
> --> > -->
</div> </div>
<div class="follow-form"> <div class="follow-form">
<el-form :inline="true" :model="searchForm" class="follow-form-item" label-width="80px"> <el-form :inline="true" :model="searchForm" class="follow-form-item" label-width="90px">
<el-row> <el-row>
<el-form-item size="small" label="关联企微"> <el-form-item size="small" label="关联企微">
<el-select v-model="searchForm.isRelevance" placeholder="请选择"> <el-select v-model="searchForm.isRelevance" placeholder="请选择">
...@@ -61,6 +61,17 @@ ...@@ -61,6 +61,17 @@
<el-form-item class="merchant-wx" size="small"> <el-form-item class="merchant-wx" size="small">
<el-input size="small" v-model="searchForm.merchantName" placeholder="请输入商户名称/关联的企业微信名"></el-input> <el-input size="small" v-model="searchForm.merchantName" placeholder="请输入商户名称/关联的企业微信名"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" label="商户号">
<el-input size="small" v-model="searchForm.merchantNo" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入商户号,仅限11位" maxlength="11"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right" v-if="$globalState.session.accountLevel == 4">
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-row>
<el-row v-if="$globalState.session.accountLevel != 4">
<el-form-item size="small" label="上级商户号">
<el-input size="small" v-model="searchForm.parentMerchantNo" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入上级商户号,仅限11位" maxlength="11"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right"> <el-form-item size="small" style="float: right">
<el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item> </el-form-item>
...@@ -255,6 +266,11 @@ export default { ...@@ -255,6 +266,11 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1); box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 10px; padding: 10px;
/deep/ {
.el-input--small .el-input__inner {
width: 215px;
}
}
} }
.accountType-row { .accountType-row {
text-align: left; text-align: left;
...@@ -287,8 +303,8 @@ export default { ...@@ -287,8 +303,8 @@ export default {
.merchant-wx { .merchant-wx {
margin-left: 20px; margin-left: 20px;
/deep/ { /deep/ {
.el-input__inner { .el-input--small .el-input__inner {
width: 310px; width: 325px;
} }
} }
} }
......
...@@ -5,39 +5,11 @@ ...@@ -5,39 +5,11 @@
</div> --> </div> -->
<div class="container edit-box"> <div class="container edit-box">
<p class="edit-title">员工基本信息</p> <p class="edit-title">员工基本信息</p>
<glsx-combi-form <glsx-combi-form style="margin: 20px 20px 0 0" ref="editFormRef" defaultWidth="320px" @handleImgDelete="handleImgDelete" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule" isEdit="true">
style="margin: 20px 20px 0 0;"
ref="editFormRef"
defaultWidth="320px"
@handleImgDelete="handleImgDelete"
:isBlock="isBlock"
:formRef="editChildRef"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
isEdit="true"
>
<template slot="merchantId" slot-scope="item"> <template slot="merchantId" slot-scope="item">
<span <span class="txt-ellipsis" v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)" :title="editForm.merchantName">{{ editForm.merchantName }}</span>
class="txt-ellipsis" <el-select v-else :style="{ width: item.scope.width }" v-model="editForm[item.scope.name]" :clearable="item.scope.isClear || false" :placeholder="'请选择' + item.scope.label" :filterable="!item.scope.noFilter" @change="handleChangeMerchant($event)">
v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)" <el-option v-for="subItem in baseData.allMerchantList" :key="subItem[item.scope.optionId]" :label="subItem[item.scope.optionLabel]" :value="subItem[item.scope.optionId]"></el-option>
:title="editForm.merchantName"
>{{ editForm.merchantName}}</span>
<el-select
v-else
:style="{ width: item.scope.width }"
v-model="editForm[item.scope.name]"
:clearable="item.scope.isClear || false"
:placeholder="'请选择' + item.scope.label"
:filterable="!item.scope.noFilter"
@change="handleChangeMerchant($event)"
>
<el-option
v-for="subItem in baseData.allMerchantList"
:key="subItem[item.scope.optionId]"
:label="subItem[item.scope.optionLabel]"
:value="subItem[item.scope.optionId]"
></el-option>
</el-select> </el-select>
<!-- <select-page v-else :form="editForm" width="320" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page> --> <!-- <select-page v-else :form="editForm" width="320" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page> -->
</template> </template>
...@@ -49,26 +21,9 @@ ...@@ -49,26 +21,9 @@
<el-button class="m-l-10 el-icon-refresh" type="primary" @click="handleRefresh">刷新</el-button> <el-button class="m-l-10 el-icon-refresh" type="primary" @click="handleRefresh">刷新</el-button>
</template> </template>
<template slot="visibleInferiorMer" slot-scope="item"> <template slot="visibleInferiorMer" slot-scope="item">
<el-input <el-input :style="{ width: item.width || '320px' }" placeholder="可见商户" v-model="filterText"></el-input>
:style="{ width: item.width || '320px' }" <el-button class="m-l-10" type="primary" @click="checkAll">{{ isCheckAll ? '全不选' : '全选' }}</el-button>
placeholder="可见商户" <el-tree v-show="baseData.merchantTree.length != 0" show-checkbox check-on-click-node check-strictly class="filter-tree" node-key="id" :data="baseData.merchantTree" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @check="handleClickNode"></el-tree>
v-model="filterText"
></el-input>
<el-button class="m-l-10" type="primary" @click="checkAll">{{isCheckAll ? '全不选':'全选'}}</el-button>
<el-tree
v-show="baseData.merchantTree.length != 0"
show-checkbox
check-on-click-node
check-strictly
class="filter-tree"
node-key="id"
:data="baseData.merchantTree"
:props="defaultProps"
default-expand-all
:filter-node-method="filterNode"
ref="tree"
@check="handleClickNode"
></el-tree>
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -113,6 +68,7 @@ export default { ...@@ -113,6 +68,7 @@ export default {
value: 'id', value: 'id',
label: 'label' label: 'label'
}, },
editStatus: false,
editForm: { editForm: {
merchantId: '', merchantId: '',
merchantName: '', merchantName: '',
...@@ -248,6 +204,12 @@ export default { ...@@ -248,6 +204,12 @@ export default {
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.tree.filter(val) this.$refs.tree.filter(val)
},
editForm: {
handler() {
this.editStatus = true
},
deep: true
} }
}, },
...@@ -289,6 +251,9 @@ export default { ...@@ -289,6 +251,9 @@ export default {
fileName: res.merchantFileResponse ? res.merchantFileResponse.fileName : '' fileName: res.merchantFileResponse ? res.merchantFileResponse.fileName : ''
} }
this.handleChangeMerchant(this.editForm.merchantId, true) this.handleChangeMerchant(this.editForm.merchantId, true)
this.$nextTick(()=>{
this.editStatus = false
})
}) })
}, },
handleChangeMerchant(e, editRecovery = false) { handleChangeMerchant(e, editRecovery = false) {
...@@ -394,16 +359,30 @@ export default { ...@@ -394,16 +359,30 @@ export default {
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
this.handleCancel() this.$router.push({
path: '/employee/index'
})
} }
}) })
} }
}) })
}, },
handleCancel() { handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push({ this.$router.push({
path: '/employee/index' path: '/employee/index'
}) })
})
} else {
this.$router.push({
path: '/employee/index'
})
}
}, },
getAllId(data, arr = []) { getAllId(data, arr = []) {
if (data) { if (data) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!