Commit e26ea395 by 杨北旺

修复门点端角色新建报错bug

1 parent 95526d49
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
</div> </div>
<div class="main_widget"> <div class="main_widget">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item v-if="pageType == 'create'&&accountLevel!=4" label="所属商户" prop="merchantId"> <el-form-item v-if="pageType == 'create' && accountLevel != 4" label="所属商户" prop="merchantId">
<el-select size="small" style="width: 40%" v-model="ruleForm.merchantId" clearable filterable placeholder="请选择" @change="selectMerchant"> <el-select size="small" style="width: 40%" v-model="ruleForm.merchantId" clearable filterable placeholder="请选择" @change="selectMerchant">
<el-option v-for="item in merchantList" :key="item.id" :label="item.merchantName" :value="item.id"></el-option> <el-option v-for="item in merchantList" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'create'&&accountLevel==4"> <el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'create' && accountLevel == 4">
<el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input> <el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'"> <el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'">
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<el-input size="small" maxlength="20" show-word-limit style="width: 40%" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input> <el-input size="small" maxlength="20" show-word-limit style="width: 40%" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色说明" prop="roleDesc"> <el-form-item label="角色说明" prop="roleDesc">
<el-input size="small" maxlength="50" show-word-limit style="width: 40%" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input> <el-input size="small" maxlength="50" show-word-limit style="width: 40%" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="角色权限" prop="roleRoot"> <!-- <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element"> <div class="custom_element">
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
</div> </div>
</template> </template>
</div> </div>
<div class="el-form-item__error" v-if="roleRootRules"> <div class="el-form-item__error" v-if="roleRootRules">请选择角色权限</div>
请选择角色权限
</div>
</div> </div>
</div> </div>
</el-col> </el-col>
...@@ -129,7 +127,7 @@ export default { ...@@ -129,7 +127,7 @@ export default {
this.getMerchantTree(id, res.responseList) this.getMerchantTree(id, res.responseList)
this.$refs.productFrom.accountTypeSearchRequest({ id: res.merchantId }, this.roleInfo.responseList) this.$refs.productFrom.accountTypeSearchRequest({ id: res.merchantId }, this.roleInfo.responseList)
this.rootList = res.responseList || [] this.rootList = res.responseList || []
if(res.delFlag==1){ if (res.delFlag == 1) {
this.selectMerchant(res.merchantId) this.selectMerchant(res.merchantId)
} }
}) })
...@@ -152,6 +150,10 @@ export default { ...@@ -152,6 +150,10 @@ export default {
getMerchantName() { getMerchantName() {
this.$apis.role.merchantDataList({ source: 'glsx' }).then(res => { this.$apis.role.merchantDataList({ source: 'glsx' }).then(res => {
this.merchantList = res this.merchantList = res
if (this.accountLevel == 4) {
this.ruleForm.merchantId = this.merchantList[0].id
this.selectMerchant(this.merchantList[0].id)
}
// this.filterList() // this.filterList()
}) })
}, },
...@@ -195,7 +197,7 @@ export default { ...@@ -195,7 +197,7 @@ export default {
}) })
console.log(this.rootList, accounttypeId, '99999') console.log(this.rootList, accounttypeId, '99999')
this.accounttypeIds = accounttypeId this.accounttypeIds = accounttypeId
this.$refs.productFrom.findMenuFunTree(item.accounttypeId,item.select) this.$refs.productFrom.findMenuFunTree(item.accounttypeId, item.select)
}, },
// 确定按钮---处理参数---提交数据---创建为0---草稿为1 // 确定按钮---处理参数---提交数据---创建为0---草稿为1
...@@ -293,7 +295,12 @@ export default { ...@@ -293,7 +295,12 @@ export default {
} }
}, },
async created() { async created() {
const { session } = this.$globalState
this.accountLevel = session.accountLevel
if (this.accountLevel == 4) {
this.ruleForm.merchantName = session.merchantName
}
let id = Number(this.$route.params.id) let id = Number(this.$route.params.id)
if (!id) { if (!id) {
this.pageName = '新增角色' this.pageName = '新增角色'
...@@ -307,20 +314,14 @@ export default { ...@@ -307,20 +314,14 @@ export default {
// document.getElementsByClassName('el-breadcrumb__item')[3].innerText='修改角色' // document.getElementsByClassName('el-breadcrumb__item')[3].innerText='修改角色'
// document.getElementById('tab-/account/role/create').innerHTML='修改角色' // document.getElementById('tab-/account/role/create').innerHTML='修改角色'
} }
const { session } = this.$globalState
this.accountLevel = session.accountLevel
if(this.accountLevel==4){
this.ruleForm.merchantId = session.merchantId
this.ruleForm.merchantName = session.merchantName
}
}, },
mounted() { mounted() {
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
if(this.accountLevel==4){ // if(this.accountLevel==4){
this.selectMerchant(this.ruleForm.merchantId) // this.selectMerchant(this.ruleForm.merchantId)
} // }
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!