Browse Source

客户菜单配置

dev
jiangyy 4 years ago
parent
commit
6765626806
  1. 185
      epmet-oper-web/src/views/modules/workPc/customer-add-or-update.vue
  2. 17
      epmet-oper-web/src/views/modules/workPc/menu.vue

185
epmet-oper-web/src/views/modules/workPc/customer-add-or-update.vue

@ -0,0 +1,185 @@
<template>
<el-dialog :visible.sync="visible"
:title="'选择客户'"
:close-on-click-modal="false"
:close-on-press-escape="false">
<div class="customerDiv">
<div class="customerItem"
v-for="(item,index) in customerList"
:key="index">
<el-checkbox class="item_check"
v-model="item.check"></el-checkbox>
<span class="item_span">{{item.customerName}}</span>
</div>
</div>
<!-- <el-row>
<el-col :span="12">
<el-form-item size="mini"
:label="$t('role.menuList')">
<el-tree :data="menuList"
:props="{ label: 'name', children: 'children' }"
node-key="id"
ref="menuListTree"
accordion
show-checkbox>
</el-tree>
</el-form-item>
</el-col>
</el-row> -->
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary"
@click="saveMenuList()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import { Loading } from 'element-ui' // Loading
import { requestPost } from "@/js/dai/request";
let loading //
export default {
data () {
return {
visible: false,
tableId: "",//id
customerList: [],//
menuList: [],//
// deptList: [],
checkCustomerList: []
}
},
computed: {
},
methods: {
async init (tableId) {
this.visible = true
this.tableId = tableId
this.startLoading()
// this.$refs.menuListTree.setCheckedKeys([])
// this.$refs.deptListTree.setCheckedKeys([])
this.customerList = []
this.menuList = []
await this.getMenuList()
await this.getCustomerList()
this.endLoading()
},
//
async getMenuList () {
// const url = "https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/gov/access/govcustomermenu/getcustomerids"
const url = "/gov/access/govcustomermenu/getcustomerids"
const params = {
tableId: this.tableId
}
const { data, code, msg, internalMsg } = await requestPost(url, params)
if (code === 0) {
this.menuList = data
} else {
this.$message.error(msg + ":" + internalMsg)
}
},
async getCustomerList () {
window.app.ajax.get(
"/oper/crm/customer/getvalidcustomerlist",
{},
(data, rspMsg) => {
this.customerList = data;
if (this.menuList.length > 0) {
this.customerList.forEach(item => {
for (let i = 0; i < this.menuList.length; i++) {
console.log(this.menuList[i])
if (item.customerId === this.menuList[i]) {
item.check = true
// break
}
}
});
}
console.log(this.customerList)
},
(rspMsg, data) => {
this.$message.error(rspMsg)
}
)
},
async saveMenuList () {
this.checkCustomerList = []
// const url = "https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/gov/access/govcustomermenu/addcustomermenu"
const url = "/gov/access/govcustomermenu/addcustomermenu"
// this.upOrDownForm.roleList = roleList
this.customerList.forEach(element => {
if (element.check) {
this.checkCustomerList.push(element.customerId)
}
});
const parmas = {
tableId: this.tableId,
customerIds: this.checkCustomerList
}
const { data, code, msg, internalMsg } = await requestPost(url, parmas)
if (code === 0) {
this.$message.success("保存成功")
this.visible = false
} else {
this.$message.error(msg + ":" + internalMsg)
}
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
})
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
}
}
</script>
<style scoped>
.customerDiv {
margin-left: 100px;
}
.customerItem {
margin: 20px;
font-size: 15px;
}
.item_check {
}
.item_span {
margin-left: 20px;
}
</style>

17
epmet-oper-web/src/views/modules/workPc/menu.vue

@ -70,6 +70,9 @@
<el-button type="text" <el-button type="text"
size="small" size="small"
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
<el-button type="text"
size="small"
@click="showCustomerMenu(scope.row.id)">{{ '客户配置' }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -77,6 +80,9 @@
<add-or-update v-if="addOrUpdateVisible" <add-or-update v-if="addOrUpdateVisible"
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="getDataList"></add-or-update> @refreshDataList="getDataList"></add-or-update>
<!-- 客户菜单配置 -->
<customer-add-or-update ref="customerForm"
@refreshDataList="getDataList"></customer-add-or-update>
</div> </div>
</el-card> </el-card>
</template> </template>
@ -84,6 +90,7 @@
<script> <script>
import mixinViewModule from '@/mixins/view-module' import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './menu-add-or-update' import AddOrUpdate from './menu-add-or-update'
import CustomerAddOrUpdate from './customer-add-or-update'
export default { export default {
mixins: [mixinViewModule], mixins: [mixinViewModule],
data () { data () {
@ -91,11 +98,17 @@ export default {
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: '/gov/access/menu/list', getDataListURL: '/gov/access/menu/list',
deleteURL: '/gov/access/menu' deleteURL: '/gov/access/menu'
} },
customerFormVisible: false
} }
}, },
components: { components: {
AddOrUpdate AddOrUpdate, CustomerAddOrUpdate
},
methods: {
showCustomerMenu (tableId) {
this.$refs['customerForm'].init(tableId)
}
} }
} }
</script> </script>

Loading…
Cancel
Save