给客户信息页面增加分配用户的功能
This commit is contained in:
@@ -92,6 +92,7 @@ const addUserBusiness = (params)=>postAction("/userBusiness/add",params);
|
||||
const editUserBusiness = (params)=>putAction("/userBusiness/update",params);
|
||||
const checkUserBusiness = (params)=>getAction("/userBusiness/checkIsValueExist",params);
|
||||
const updateBtnStrByRoleId = (params)=>postAction("/userBusiness/updateBtnStr",params);
|
||||
const updateOneValueByKeyIdAndType = (params)=>postAction("/userBusiness/updateOneValueByKeyIdAndType",params);
|
||||
//多单位
|
||||
const addUnit = (params)=>postAction("/unit/add",params);
|
||||
const editUnit = (params)=>putAction("/unit/update",params);
|
||||
@@ -188,6 +189,7 @@ export {
|
||||
editUserBusiness,
|
||||
checkUserBusiness,
|
||||
updateBtnStrByRoleId,
|
||||
updateOneValueByKeyIdAndType,
|
||||
addUnit,
|
||||
editUnit,
|
||||
checkUnit,
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a v-if="btnEnableList.indexOf(1)>-1 && customerFlag === '1' && quickBtn.user.indexOf(1)>-1 " @click="btnSetUser(record)">分配用户</a>
|
||||
<a-divider v-if="btnEnableList.indexOf(1)>-1 && customerFlag === '1' && quickBtn.user.indexOf(1)>-1 " type="vertical" />
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
|
||||
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
@@ -86,6 +88,7 @@
|
||||
<!-- 表单区域 -->
|
||||
<customer-modal ref="modalForm" @ok="modalFormOk"></customer-modal>
|
||||
<import-file-modal ref="modalImportForm" @ok="modalFormOk"></import-file-modal>
|
||||
<customer-user-modal ref="customerUserModal"></customer-user-modal>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -94,8 +97,10 @@
|
||||
<script>
|
||||
import CustomerModal from './modules/CustomerModal'
|
||||
import ImportFileModal from '@/components/tools/ImportFileModal'
|
||||
import CustomerUserModal from './modules/CustomerUserModal'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
import { getCurrentSystemConfig } from '@/api/api'
|
||||
import Vue from 'vue'
|
||||
export default {
|
||||
name: "CustomerList",
|
||||
@@ -103,6 +108,7 @@
|
||||
components: {
|
||||
CustomerModal,
|
||||
ImportFileModal,
|
||||
CustomerUserModal,
|
||||
JDate
|
||||
},
|
||||
data () {
|
||||
@@ -122,9 +128,13 @@
|
||||
telephone:'',
|
||||
phonenum:''
|
||||
},
|
||||
customerFlag: '0',
|
||||
ipagination:{
|
||||
pageSizeOptions: ['10', '20', '30', '100', '200']
|
||||
},
|
||||
quickBtn: {
|
||||
user: ''
|
||||
},
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
@@ -140,7 +150,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 100,
|
||||
width: 130,
|
||||
align:"center",
|
||||
scopedSlots: { customRender: 'action' },
|
||||
},
|
||||
@@ -173,13 +183,38 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getSystemConfig()
|
||||
this.initQuickBtn()
|
||||
},
|
||||
methods: {
|
||||
getSystemConfig() {
|
||||
getCurrentSystemConfig().then((res) => {
|
||||
if(res.code === 200 && res.data){
|
||||
this.customerFlag = res.data.customerFlag
|
||||
}
|
||||
})
|
||||
},
|
||||
//加载快捷按钮:分配用户
|
||||
initQuickBtn() {
|
||||
let btnStrList = Vue.ls.get('winBtnStrList') //按钮功能列表 JSON字符串
|
||||
if (btnStrList) {
|
||||
for (let i = 0; i < btnStrList.length; i++) {
|
||||
if (btnStrList[i].btnStr) {
|
||||
this.quickBtn.user = btnStrList[i].url === '/system/user'?btnStrList[i].btnStr:this.quickBtn.user
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
searchQuery() {
|
||||
this.loadData(1);
|
||||
this.getSystemConfig()
|
||||
},
|
||||
searchReset() {
|
||||
this.queryParam = {
|
||||
type:'客户',
|
||||
}
|
||||
this.loadData(1);
|
||||
this.loadData(1)
|
||||
this.getSystemConfig()
|
||||
},
|
||||
handleImportXls() {
|
||||
let importExcelUrl = this.url.importExcelUrl
|
||||
@@ -195,6 +230,11 @@
|
||||
if(this.btnEnableList.indexOf(1)===-1) {
|
||||
this.$refs.modalForm.isReadOnly = true
|
||||
}
|
||||
},
|
||||
btnSetUser(record) {
|
||||
this.$refs.customerUserModal.edit(record);
|
||||
this.$refs.customerUserModal.title = "分配用户给:" + record.supplier
|
||||
this.$refs.customerUserModal.disableSubmit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 100,
|
||||
width: 130,
|
||||
align:"center",
|
||||
scopedSlots: { customRender: 'action' },
|
||||
},
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 100,
|
||||
width: 130,
|
||||
align:"center",
|
||||
scopedSlots: { customRender: 'action' },
|
||||
},
|
||||
|
||||
172
jshERP-web/src/views/system/modules/CustomerUserModal.vue
Normal file
172
jshERP-web/src/views/system/modules/CustomerUserModal.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div ref="container">
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
:getContainer="() => $refs.container"
|
||||
:maskStyle="{'top':'93px','left':'154px'}"
|
||||
:wrapClassName="wrapClassNameInfo()"
|
||||
:mask="isDesktop()"
|
||||
:maskClosable="false"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="取消"
|
||||
okText="保存"
|
||||
style="top:5%;height: 95%;">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-col :md="10" :sm="24">
|
||||
<template>
|
||||
<a-tree
|
||||
checkable
|
||||
multiple
|
||||
@check="onCheck"
|
||||
:selectedKeys="selectedKeys"
|
||||
:checkedKeys="checkedKeys"
|
||||
:treeData="roleFunctionTree"
|
||||
:checkStrictly="checkStrictly"
|
||||
:expandedKeys="iExpandedKeys"
|
||||
:autoExpandParent="true"
|
||||
@expand="onExpand"/>
|
||||
</template>
|
||||
</a-col>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {mixinDevice} from '@/utils/mixin'
|
||||
import {updateOneValueByKeyIdAndType} from '@/api/api'
|
||||
import {getAction} from '../../../api/manage'
|
||||
export default {
|
||||
name: "CustomerUserModal",
|
||||
mixins: [mixinDevice],
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
customerId: 0,
|
||||
iExpandedKeys: [],
|
||||
roleFunctionTree: [],
|
||||
checkedKeys: [],
|
||||
selectedKeys: [],
|
||||
checkStrictly: false,
|
||||
hiding: true,
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, {});
|
||||
this.visible = true
|
||||
this.customerId = record.id
|
||||
this.checkedKeys = []
|
||||
this.loadTree(record.id)
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let formData = Object.assign(this.model, values);
|
||||
formData.type = 'UserCustomer'
|
||||
formData.keyIds = this.checkedKeys
|
||||
formData.oneValue = this.customerId
|
||||
updateOneValueByKeyIdAndType(formData).then((res)=>{
|
||||
if(res.code === 200){
|
||||
that.$message.info('保存成功');
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.data.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
loadTree(id) {
|
||||
let that = this
|
||||
that.treeData = []
|
||||
that.roleFunctionTree = []
|
||||
let params = {};
|
||||
params.id='';
|
||||
getAction('/supplier/getCustomerUser?UBType=UserCustomer&UBValue='+id).then((res) => {
|
||||
if (res) {
|
||||
//机构全选后,再添加机构,选中数量增多
|
||||
this.allTreeKeys = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
let temp = res[i]
|
||||
that.treeData.push(temp)
|
||||
that.roleFunctionTree.push(temp)
|
||||
that.setThisExpandedKeys(temp)
|
||||
that.getAllKeys(temp);
|
||||
}
|
||||
console.log(JSON.stringify(this.checkedKeys))
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
onCheck(checkedKeys, info) {
|
||||
console.log('onCheck', checkedKeys, info)
|
||||
this.hiding = false
|
||||
if(this.checkStrictly){
|
||||
this.checkedKeys = checkedKeys.checked;
|
||||
}else{
|
||||
this.checkedKeys = checkedKeys
|
||||
}
|
||||
},
|
||||
setThisExpandedKeys(node) {
|
||||
if(node.checked==true) {
|
||||
this.checkedKeys.push(node.key)
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.iExpandedKeys.push(node.key)
|
||||
for (let a = 0; a < node.children.length; a++) {
|
||||
this.setThisExpandedKeys(node.children[a])
|
||||
}
|
||||
}
|
||||
},
|
||||
getAllKeys(node) {
|
||||
// console.log('node',node);
|
||||
this.allTreeKeys.push(node.key)
|
||||
if (node.children && node.children.length > 0) {
|
||||
for (let a = 0; a < node.children.length; a++) {
|
||||
this.getAllKeys(node.children[a])
|
||||
}
|
||||
}
|
||||
},
|
||||
onExpand(expandedKeys) {
|
||||
console.log('onExpand', expandedKeys)
|
||||
this.iExpandedKeys = expandedKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -122,7 +122,6 @@
|
||||
},
|
||||
loadTree(id) {
|
||||
let that = this
|
||||
that.treeData = []
|
||||
that.roleFunctionTree = []
|
||||
let params = {};
|
||||
params.id='';
|
||||
@@ -132,7 +131,6 @@
|
||||
this.allTreeKeys = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
let temp = res[i]
|
||||
that.treeData.push(temp)
|
||||
that.roleFunctionTree.push(temp)
|
||||
that.setThisExpandedKeys(temp)
|
||||
that.getAllKeys(temp);
|
||||
|
||||
Reference in New Issue
Block a user