3 changed files with 446 additions and 539 deletions
@ -1,230 +1,169 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
|
<div class="mod-sys__menu"> |
||||
<div class="mod-sys__menu"> |
<div class="div_btn"> |
||||
<div class="div_btn"> |
<span style="margin-right:10px">{{ customerName }}</span> |
||||
<span style="margin-right:10px">{{customerName}}</span> |
<el-button type="default" @click="diaCancel">取消返回</el-button> |
||||
<el-button type="default" |
<!-- <el-button class="" |
||||
@click="diaCancel">取消返回</el-button> |
|
||||
<!-- <el-button class="" |
|
||||
type="primary" |
type="primary" |
||||
@click="addShow()">{{"新增" }}</el-button> --> |
@click="addShow()">{{"新增" }}</el-button> --> |
||||
<!-- <el-input v-model="search" |
<!-- <el-input v-model="search" |
||||
placeholder="请输入内容"></el-input> --> |
placeholder="请输入内容"></el-input> --> |
||||
</div> |
</div> |
||||
<div class="div_btn"> |
<div class="div_btn"> |
||||
<el-button class="" |
<el-button class="" type="primary" @click="useMenu()">开启</el-button> |
||||
type="primary" |
<el-button class="" type="primary" @click="closeMenu()">关闭</el-button> |
||||
@click="useMenu()">开启</el-button> |
</div> |
||||
<el-button class="" |
<el-table v-loading="dataListLoading" :data="dataList" row-key="id" border style="width: 100%;" @select-all="selectAll" @selection-change="handelSelection"> |
||||
type="primary" |
<el-table-column type="selection" fixed="left" align="center" width="50" /> |
||||
@click="closeMenu()">关闭</el-button> |
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> |
||||
</div> |
<el-table-column prop="name" label="菜单名称" header-align="center" min-width="150"></el-table-column> |
||||
<el-table v-loading="dataListLoading" |
<el-table-column prop="icon" label="图标" header-align="center" align="center"> |
||||
:data="dataList" |
<template slot-scope="scope"> |
||||
row-key="id" |
<svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${scope.row.icon}`"></use></svg> |
||||
border |
</template> |
||||
style="width: 100%;" |
</el-table-column> |
||||
@select-all="selectAll" |
<el-table-column prop="showFlag" label="菜单类型" header-align="center" align="center"> |
||||
@selection-change="handelSelection"> |
<template slot-scope="scope"> |
||||
<el-table-column |
基础应用 |
||||
type="selection" |
</template> |
||||
fixed="left" |
</el-table-column> |
||||
align="center" |
<el-table-column prop="sort" :label="$t('menu.sort')" header-align="center" align="center"></el-table-column> |
||||
width="50" |
<el-table-column prop="useFlag" :label="$t('menu.status')" header-align="center" align="center"> |
||||
/> |
<template slot-scope="scope"> |
||||
|
<el-tag v-if="scope.row.useFlag === '0'" size="small">{{ $t('menu.status0') }}</el-tag> |
||||
<el-table-column prop="name" |
<el-tag v-else size="small" type="info">{{ $t('menu.status1') }}</el-tag> |
||||
:label="$t('menu.name')" |
</template> |
||||
header-align="center" |
</el-table-column> |
||||
min-width="150"></el-table-column> |
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
||||
<el-table-column prop="icon" |
<template slot-scope="scope"> |
||||
:label="$t('menu.icon')" |
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
||||
header-align="center" |
<el-button v-if="scope.row.useFlag === '0'" type="text" size="small" @click="useUpdate(scope.row.id, '1')">开启</el-button> |
||||
align="center"> |
<el-button v-if="scope.row.useFlag === '1'" type="text" size="small" @click="useUpdate(scope.row.id, '0')">关闭</el-button> |
||||
<template slot-scope="scope"> |
</template> |
||||
<svg class="icon-svg" |
</el-table-column> |
||||
aria-hidden="true"> |
</el-table> |
||||
<use :xlink:href="`#${scope.row.icon}`"></use> |
<!-- 弹窗, 新增 / 修改 --> |
||||
</svg> |
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
||||
</template> |
</div> |
||||
</el-table-column> |
</div> |
||||
|
|
||||
<el-table-column prop="sort" |
|
||||
:label="$t('menu.sort')" |
|
||||
header-align="center" |
|
||||
align="center"></el-table-column> |
|
||||
<el-table-column prop="useFlag" |
|
||||
:label="$t('menu.status')" |
|
||||
header-align="center" |
|
||||
align="center"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-tag v-if="scope.row.useFlag === '0'" |
|
||||
size="small">{{ $t('menu.status0') }}</el-tag> |
|
||||
<el-tag v-else |
|
||||
size="small" |
|
||||
type="info">{{ $t('menu.status1') }}</el-tag> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
|
|
||||
<el-table-column :label="$t('handle')" |
|
||||
fixed="right" |
|
||||
header-align="center" |
|
||||
align="center" |
|
||||
width="150"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-button type="text" |
|
||||
size="small" |
|
||||
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|
||||
<el-button v-if="scope.row.useFlag === '0'" |
|
||||
type="text" |
|
||||
size="small" |
|
||||
@click="useUpdate(scope.row.id,'1')">开启</el-button> |
|
||||
<el-button v-if="scope.row.useFlag === '1'" |
|
||||
type="text" |
|
||||
size="small" |
|
||||
@click="useUpdate(scope.row.id,'0')">关闭</el-button> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
</el-table> |
|
||||
<!-- 弹窗, 新增 / 修改 --> |
|
||||
<add-or-update v-if="addOrUpdateVisible" |
|
||||
ref="addOrUpdate" |
|
||||
@refreshDataList="getDataList"></add-or-update> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
|
import { requestPost } from '@/js/dai/request'; |
||||
import { requestPost } from '@/js/dai/request' |
import mixinViewModule from '@/mixins/view-module'; |
||||
import mixinViewModule from '@/mixins/view-module' |
import AddOrUpdate from './menu-customer-add-or-update'; |
||||
import AddOrUpdate from './menu-customer-add-or-update' |
|
||||
export default { |
export default { |
||||
mixins: [mixinViewModule], |
mixins: [mixinViewModule], |
||||
data () { |
data() { |
||||
return { |
return { |
||||
customerId: '', // 客户id,父组件传 |
customerId: '', // 客户id,父组件传 |
||||
customerName: '', // 客户名称,父组件传 |
customerName: '', // 客户名称,父组件传 |
||||
|
|
||||
tableParams: { |
tableParams: { |
||||
customerId: '' |
customerId: '' |
||||
}, |
}, |
||||
search: '', |
search: '', |
||||
dataList: [], |
dataList: [], |
||||
selection: [], |
multipleSelection: [], |
||||
selAllFlag: false, |
selAllFlag: false, |
||||
|
|
||||
dataListLoading: false, |
dataListLoading: false, |
||||
|
|
||||
mixinViewModuleOptions: { |
mixinViewModuleOptions: { |
||||
getDataListURL: '/gov/access/menu/customerMenuList' |
getDataListURL: '/gov/access/menu/customerMenuList' |
||||
} |
} |
||||
|
}; |
||||
} |
}, |
||||
}, |
|
||||
|
computed: {}, |
||||
computed: { |
components: { |
||||
}, |
AddOrUpdate |
||||
components: { |
}, |
||||
AddOrUpdate |
created() {}, |
||||
}, |
methods: { |
||||
created() { |
useMenu() { |
||||
|
let ids = this.selection.map(item => item.id); |
||||
}, |
this.$http |
||||
methods: { |
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
||||
|
ids: ids, |
||||
useMenu(){ |
use: '1' |
||||
let ids = this.selection.map((item) => item.id); |
}) |
||||
this.$http |
.then(({ data: res }) => { |
||||
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
return this.$message.success('操作成功'); |
||||
ids: ids, |
}); |
||||
use: '1' |
this.query(); |
||||
}) |
}, |
||||
.then(({ data: res }) => { |
closeMenu() { |
||||
return this.$message.success("操作成功"); |
let ids = this.selection.map(item => item.id); |
||||
}) |
this.$http |
||||
this.query(); |
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
||||
}, |
ids: ids, |
||||
closeMenu(){ |
use: '0' |
||||
let ids = this.selection.map((item) => item.id); |
}) |
||||
this.$http |
.then(({ data: res }) => { |
||||
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
return this.$message.success('操作成功'); |
||||
ids: ids, |
}); |
||||
use: '0' |
this.query(); |
||||
}) |
}, |
||||
.then(({ data: res }) => { |
useUpdate(id, use) { |
||||
return this.$message.success("操作成功"); |
this.$http |
||||
|
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
||||
}) |
ids: [id], |
||||
this.query(); |
use: use |
||||
}, |
}) |
||||
useUpdate(id,use){ |
.then(({ data: res }) => { |
||||
this.$http |
return this.$message.success('操作成功'); |
||||
.post('/gov/access/govMenuCustomerRelation/useUpdate', { |
}); |
||||
ids: [id], |
this.query(); |
||||
use: use |
}, |
||||
}) |
query() { |
||||
.then(({ data: res }) => { |
this.dataListLoading = true; |
||||
return this.$message.success("操作成功"); |
this.$http |
||||
}) |
.post('/gov/access/menu/customerMenuList', { |
||||
this.query(); |
customerId: this.customerId, |
||||
}, |
tableName: 'gov_menu' |
||||
query() { |
}) |
||||
|
.then(({ data: res }) => { |
||||
this.dataListLoading = true |
this.dataListLoading = false; |
||||
this.$http |
if (res.code !== 0) { |
||||
.post('/gov/access/menu/customerMenuList', { |
this.dataList = []; |
||||
customerId: this.customerId, |
this.total = 0; |
||||
tableName: 'gov_menu' |
return this.$message.error(res.msg); |
||||
}) |
} |
||||
.then(({ data: res }) => { |
this.dataList = res.data; |
||||
this.dataListLoading = false |
}) |
||||
if (res.code !== 0) { |
.catch(() => { |
||||
this.dataList = [] |
this.dataListLoading = false; |
||||
this.total = 0 |
}); |
||||
return this.$message.error(res.msg) |
}, |
||||
} |
|
||||
this.dataList = res.data |
initData(customerId, customerName) { |
||||
}) |
this.customerId = customerId; |
||||
.catch(() => { |
this.customerName = customerName; |
||||
this.dataListLoading = false |
// if (this.mixinViewModuleOptions.createdIsNeed) { |
||||
}) |
// console.log(this.customerId+"22222"); |
||||
}, |
this.query(); |
||||
|
// } |
||||
initData (customerId, customerName) { |
}, |
||||
this.customerId = customerId |
|
||||
this.customerName = customerName |
handelSelection(row) { |
||||
// if (this.mixinViewModuleOptions.createdIsNeed) { |
this.multipleSelection = []; |
||||
// console.log(this.customerId+"22222"); |
val.forEach(element => { |
||||
this.query() |
this.multipleSelection.push(element.id); |
||||
// } |
}); |
||||
|
console.log(this.multipleSelection); |
||||
}, |
}, |
||||
|
// 取消 |
||||
selectAll(selection) { |
diaCancel() { |
||||
this.selection = selection; |
this.$emit('cancleBack'); |
||||
if (selection.length > 0) { |
} |
||||
this.selAllFlag = true; |
} |
||||
} else { |
}; |
||||
this.selAllFlag = false; |
|
||||
} |
|
||||
}, |
|
||||
handelSelection(row){ |
|
||||
this.selection = row |
|
||||
}, |
|
||||
// 取消 |
|
||||
diaCancel () { |
|
||||
this.$emit('cancleBack') |
|
||||
}, |
|
||||
} |
|
||||
} |
|
||||
</script> |
</script> |
||||
|
|
||||
<style> |
<style> |
||||
.div_btn { |
.div_btn { |
||||
margin: 0 0 20px 0; |
margin: 0 0 20px 0; |
||||
} |
} |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue