parent
36c1a45fe2
commit
f508148177
61 changed files with 4383 additions and 5072 deletions
After Width: | Height: | Size: 702 B |
@ -1,244 +1,248 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="per_title" v-preventReClick @click="goback()"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">{{customerName}}</span> |
||||
</div> |
||||
</el-card> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="per_title" v-preventReClick @click="goback()"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">{{ customerName }}</span> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20 user_header"> |
||||
<p class="addhr_tag"></p> |
||||
<span>代理配置</span> |
||||
</div> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20 user_header"> |
||||
<p class="addhr_tag"></p> |
||||
<span>代理配置</span> |
||||
</div> |
||||
|
||||
<div class="flex-between"> |
||||
<span>内网地址配置</span> |
||||
<div class="border_lf flex-column"> |
||||
<p class="marb30">平台服务</p> |
||||
<div class="flex-center"> |
||||
<label>IP</label> |
||||
<el-input placeholder="请输入IP地址" class="mar_input"></el-input> |
||||
<label>端口</label> |
||||
<el-input placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
<div class="border_lf pad_none flex-column"> |
||||
<p class="marb30">流媒体服务</p> |
||||
<div class="flex-center"> |
||||
<label>IP</label> |
||||
<el-input placeholder="请输入IP地址" class="mar_input"></el-input> |
||||
<label>端口</label> |
||||
<el-input placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<div class="flex-between"> |
||||
<span>内网地址配置</span> |
||||
<div class="border_lf flex-column"> |
||||
<p class="marb30">平台服务</p> |
||||
<div class="flex-center"> |
||||
<label>IP</label> |
||||
<el-input placeholder="请输入IP地址" class="mar_input"></el-input> |
||||
<label>端口</label> |
||||
<el-input placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
<div class="border_lf pad_none flex-column"> |
||||
<p class="marb30">流媒体服务</p> |
||||
<div class="flex-center"> |
||||
<label>IP</label> |
||||
<el-input placeholder="请输入IP地址" class="mar_input"></el-input> |
||||
<label>端口</label> |
||||
<el-input placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>应用列表</span> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" stripe :span-method="SpanMethod" header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="应用名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="storeName" label="使用期限" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="total" label="启用时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="payamount" label="结束时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="payamount" label="剩余时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp" v-if="scope.row.Intranet != ''"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp" v-if="scope.row.Intranet != ''"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
<div v-else> |
||||
<el-button type="plain" @click="chooseIp">选择IP与端口</el-button> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-switch |
||||
v-model="scope.row.swtich" |
||||
active-text="开启" |
||||
inactive-text="关闭" |
||||
@change="changeSwitch(scope.row)"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="totals"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>应用列表</span> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" :span-method="SpanMethod" header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="应用名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="storeName" label="使用期限" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="total" label="启用时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="payamount" label="结束时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="payamount" label="剩余时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp" v-if="scope.row.Intranet != ''"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp" v-if="scope.row.Intranet != ''"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
<div v-else> |
||||
<el-button type="plain" @click="chooseIp">选择IP与端口</el-button> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-switch v-model="scope.row.swtich" active-text="开启" inactive-text="关闭" |
||||
@change="changeSwitch(scope.row)"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="totals"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<!-- 选择IP --> |
||||
<el-dialog :visible.sync="ipVisible" width="70%" center> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>客户列表</span> |
||||
<!-- 选择IP --> |
||||
<el-dialog :visible.sync="ipVisible" width="70%" center> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>客户列表</span> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" header-align="center"> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" stripe header-align="center"> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="选择" align="center"> |
||||
<template slot-scope="scope"> |
||||
<i class="el-icon-success radio_icon"></i> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="teacherVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="editSure('teacherForm')">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="选择" align="center"> |
||||
<template slot-scope="scope"> |
||||
<i class="el-icon-success radio_icon"></i> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="teacherVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="editSure('teacherForm')">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data (){ |
||||
return { |
||||
customerName: this.$route.query.name, |
||||
permissionData: [{ |
||||
id: 1, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '10.20.202.1', |
||||
extranet: '10.20.202.1' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '', |
||||
extranet: '' |
||||
}], |
||||
totals: 1, |
||||
ipVisible: false |
||||
} |
||||
}, |
||||
methods: { |
||||
SpanMethod({ row, column, rowIndex, columnIndex }) { |
||||
if (rowIndex % 2 === 0) { |
||||
if (columnIndex === 6) { |
||||
if(!row.Intranet){ |
||||
return [1, 2]; |
||||
} |
||||
} |
||||
// else if (columnIndex === 1) { |
||||
// return [0, 0]; |
||||
// } |
||||
} |
||||
}, |
||||
chooseIp(){ |
||||
this.ipVisible = true |
||||
}, |
||||
goback(){ |
||||
this.$router.go(-1) |
||||
} |
||||
export default { |
||||
data () { |
||||
return { |
||||
customerName: this.$route.query.name, |
||||
permissionData: [{ |
||||
id: 1, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '10.20.202.1', |
||||
extranet: '10.20.202.1' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '', |
||||
extranet: '' |
||||
}], |
||||
totals: 1, |
||||
ipVisible: false |
||||
} |
||||
}, |
||||
methods: { |
||||
SpanMethod ({ row, column, rowIndex, columnIndex }) { |
||||
if (rowIndex % 2 === 0) { |
||||
if (columnIndex === 6) { |
||||
if (!row.Intranet) { |
||||
return [1, 2]; |
||||
} |
||||
} |
||||
// else if (columnIndex === 1) { |
||||
// return [0, 0]; |
||||
// } |
||||
} |
||||
}, |
||||
chooseIp () { |
||||
this.ipVisible = true |
||||
}, |
||||
goback () { |
||||
this.$router.go(-1) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.border_lf{ |
||||
border-left: 1px dashed #eee; |
||||
padding: 0 60px; |
||||
.border_lf { |
||||
border-left: 1px dashed #eee; |
||||
padding: 0 60px; |
||||
} |
||||
.border_lf label{ |
||||
width: 120px; |
||||
|
||||
.border_lf label { |
||||
width: 120px; |
||||
} |
||||
.pad_none{ |
||||
padding: 0 0 0 60px; |
||||
|
||||
.pad_none { |
||||
padding: 0 0 0 60px; |
||||
} |
||||
.mar_input{ |
||||
margin-right: 80px; |
||||
|
||||
.mar_input { |
||||
margin-right: 80px; |
||||
} |
||||
.marb30{ |
||||
margin-bottom: 30px; |
||||
|
||||
.marb30 { |
||||
margin-bottom: 30px; |
||||
} |
||||
.tab_temp label{ |
||||
width: 60px; |
||||
|
||||
.tab_temp label { |
||||
width: 60px; |
||||
} |
||||
.mar10{ |
||||
margin-top: 10px; |
||||
|
||||
.mar10 { |
||||
margin-top: 10px; |
||||
} |
||||
.radio_icon{ |
||||
font-size: 26px; |
||||
color: #9278FF; |
||||
|
||||
.radio_icon { |
||||
font-size: 26px; |
||||
color: #9278FF; |
||||
} |
||||
</style> |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,307 +1,306 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<div class="per_title" v-preventReClick @click="goback('back')"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">选择客户</span> |
||||
</div> |
||||
<el-button type="primary" round class="mag" v-preventReClick @click="goback()">确定 |
||||
</el-button> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<div class="per_title" v-preventReClick @click="goback('back')"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">选择客户</span> |
||||
</div> |
||||
<el-button type="primary" round class="mag" v-preventReClick @click="goback()">确定 |
||||
</el-button> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>筛选</span> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<el-col :span="6"> |
||||
<el-form-item label="国家"> |
||||
<el-select v-model="form.countries" placeholder="请选择国家"> |
||||
<el-option v-for="(item,index) in countryList" :key="index" |
||||
:label="item.name" :value="item.name"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="省份"> |
||||
<el-select v-model="form.provinces" clearable placeholder="请选择省份" |
||||
@change="getCity" @clear="clearprovince"> |
||||
<el-option v-for="(item,index) in provinceList" :key="index" |
||||
:label="item.provinceName" :value="item.provinceId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="城市"> |
||||
<el-select v-model="form.city" clearable placeholder="请选择城市" |
||||
:disabled="form.provinces ? false : true" @change="initData"> |
||||
<el-option v-for="(item,index) in cityList" :key="index" |
||||
:label="item.cityName" :value="item.cityId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item> |
||||
<el-input placeholder="请输入客户名称/联系人姓名/账号" @clear="clearSearch" |
||||
@input="getData" prefix-icon="el-icon-search" |
||||
v-model="form.keyword" clearable></el-input> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>筛选</span> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<el-col :span="6"> |
||||
<el-form-item label="国家"> |
||||
<el-select v-model="form.countries" placeholder="请选择国家"> |
||||
<el-option v-for="(item, index) in countryList" :key="index" :label="item.name" |
||||
:value="item.name"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="省份"> |
||||
<el-select v-model="form.provinces" clearable placeholder="请选择省份" @change="getCity" |
||||
@clear="clearprovince"> |
||||
<el-option v-for="(item, index) in provinceList" :key="index" :label="item.provinceName" |
||||
:value="item.provinceId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="城市"> |
||||
<el-select v-model="form.city" clearable placeholder="请选择城市" |
||||
:disabled="form.provinces ? false : true" @change="initData"> |
||||
<el-option v-for="(item, index) in cityList" :key="index" :label="item.cityName" |
||||
:value="item.cityId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item> |
||||
<el-input placeholder="请输入客户名称/联系人姓名/账号" @clear="clearSearch" @input="getData" |
||||
prefix-icon="el-icon-search" v-model="form.keyword" clearable></el-input> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="hr_tag"></p> |
||||
<span>客户列表</span> |
||||
</div> |
||||
<div> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" class="table" stripe header-align="center" row-key="customerId"> |
||||
<!-- <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> --> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="customerName" label="客户名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="行业" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span class="ellipsis">{{ scope.row.industryName }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="countries" label="国家" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="provinceName" label="省份" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="cityName" label="城市" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="联系人" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="account" label="账号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="270" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-checkbox @change="checkboxChenge(scope.row)" |
||||
v-model="scope.row.checked"></el-checkbox> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" |
||||
@current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="hr_tag"></p> |
||||
<span>客户列表</span> |
||||
</div> |
||||
<div> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" class="table" header-align="center" row-key="customerId"> |
||||
<!-- <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> --> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="customerName" label="客户名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="行业" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span class="ellipsis">{{ scope.row.industryName }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="countries" label="国家" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="provinceName" label="省份" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="cityName" label="城市" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="联系人" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="account" label="账号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="270" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-checkbox @change="checkboxChenge(scope.row)" v-model="scope.row.checked"></el-checkbox> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" |
||||
@current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
</el-row> |
||||
</div> |
||||
</el-row> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
props: { |
||||
refresh: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 1, |
||||
countryList: [{ |
||||
name: "中国" |
||||
}], |
||||
listData: [], |
||||
form: { |
||||
countries: "中国", |
||||
provinces: "", |
||||
city: "", |
||||
keyword: "" |
||||
}, |
||||
provinceList: [], |
||||
cityList: [], |
||||
checkedID: "",// 选中客户ID |
||||
checkedName: "",// 客户名称 |
||||
data:{}, |
||||
}; |
||||
}, |
||||
created() { |
||||
props: { |
||||
refresh: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 1, |
||||
countryList: [{ |
||||
name: "中国" |
||||
}], |
||||
listData: [], |
||||
form: { |
||||
countries: "中国", |
||||
provinces: "", |
||||
city: "", |
||||
keyword: "" |
||||
}, |
||||
provinceList: [], |
||||
cityList: [], |
||||
checkedID: "",// 选中客户ID |
||||
checkedName: "",// 客户名称 |
||||
data: {}, |
||||
}; |
||||
}, |
||||
created () { |
||||
this.getData(); |
||||
this.getProvince(); |
||||
}, |
||||
watch: { |
||||
refresh: function (val, val2) { |
||||
if (val) { |
||||
this.getData(); |
||||
this.getProvince(); |
||||
}, |
||||
watch: { |
||||
refresh: function(val, val2) { |
||||
if (val) { |
||||
this.getData(); |
||||
this.getProvince(); |
||||
|
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
// 取得列表 |
||||
getData () { |
||||
// const sid = this.$store.state.dataPer.find(e => e.permissionName === '客户管理') |
||||
this.$post(this.api.queryCustomer, { |
||||
countries: this.form.countries, |
||||
provinceId: this.form.provinces, |
||||
cityId: this.form.city, |
||||
searchContent: this.form.keyword, |
||||
page: this.page, |
||||
size: this.pageSize, |
||||
// supplierId: sid ? sid.supplierId : '' |
||||
}).then(res => { |
||||
res.message.list.map(e => { |
||||
e.checked = false; |
||||
if (this.checkedID) { |
||||
if (e.customerId === this.checkedID) { |
||||
e.checked = true; |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
this.listData = res.message.list; |
||||
this.total = res.message.totalCount; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
// 省份 |
||||
getProvince () { |
||||
this.$get(this.api.queryProvince).then(res => { |
||||
this.provinceList = res.list; |
||||
this.$store.commit("provinceData", { provinceList: this.provinceList }); |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
clearprovince () { |
||||
this.form.city = ""; |
||||
}, |
||||
methods: { |
||||
// 取得列表 |
||||
getData() { |
||||
// const sid = this.$store.state.dataPer.find(e => e.permissionName === '客户管理') |
||||
this.$post(this.api.queryCustomer, { |
||||
countries: this.form.countries, |
||||
provinceId: this.form.provinces, |
||||
cityId: this.form.city, |
||||
searchContent: this.form.keyword, |
||||
page: this.page, |
||||
size: this.pageSize, |
||||
// supplierId: sid ? sid.supplierId : '' |
||||
}).then(res => { |
||||
res.message.list.map(e => { |
||||
e.checked = false; |
||||
if (this.checkedID) { |
||||
if (e.customerId === this.checkedID) { |
||||
e.checked = true; |
||||
} |
||||
} |
||||
}); |
||||
this.listData = res.message.list; |
||||
this.total = res.message.totalCount; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
// 省份 |
||||
getProvince() { |
||||
this.$get(this.api.queryProvince).then(res => { |
||||
this.provinceList = res.list; |
||||
this.$store.commit("provinceData", { provinceList: this.provinceList }); |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
clearprovince() { |
||||
this.form.city = ""; |
||||
}, |
||||
getCity() { |
||||
this.clearprovince(); |
||||
this.getCityData(); |
||||
this.page = 1; |
||||
this.initData(); |
||||
}, |
||||
getCityData() { |
||||
let data = { |
||||
provinceId: this.form.provinces |
||||
}; |
||||
this.$get(this.api.queryCity, data).then(res => { |
||||
this.cityList = res.list; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
async goback(val) { |
||||
if (val) { |
||||
this.$emit("back", { show: true }); |
||||
} else { |
||||
if (!this.checkedName) { |
||||
return this.$message("请选择客户后再确定!"); |
||||
} |
||||
let param = { |
||||
show: true, |
||||
id: this.checkedID, |
||||
name: this.checkedName |
||||
}; |
||||
await this.$get(this.api.queryCustomerDetails, { customerId: this.checkedID }).then(res => { |
||||
console.log(res, "当前的res"); |
||||
this.data = res.result.customer; |
||||
param.email = this.data.email; |
||||
param.phone = this.data.phone; |
||||
param.name = this.data.customerName; |
||||
getCity () { |
||||
this.clearprovince(); |
||||
this.getCityData(); |
||||
this.page = 1; |
||||
this.initData(); |
||||
}, |
||||
getCityData () { |
||||
let data = { |
||||
provinceId: this.form.provinces |
||||
}; |
||||
this.$get(this.api.queryCity, data).then(res => { |
||||
this.cityList = res.list; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
async goback (val) { |
||||
if (val) { |
||||
this.$emit("back", { show: true }); |
||||
} else { |
||||
if (!this.checkedName) { |
||||
return this.$message("请选择客户后再确定!"); |
||||
} |
||||
let param = { |
||||
show: true, |
||||
id: this.checkedID, |
||||
name: this.checkedName |
||||
}; |
||||
await this.$get(this.api.queryCustomerDetails, { customerId: this.checkedID }).then(res => { |
||||
console.log(res, "当前的res"); |
||||
this.data = res.result.customer; |
||||
param.email = this.data.email; |
||||
param.phone = this.data.phone; |
||||
param.name = this.data.customerName; |
||||
|
||||
}); |
||||
this.$emit("back", this.data); |
||||
} |
||||
}, |
||||
initData() { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
// checkbox交互 |
||||
checkboxChenge(row) { |
||||
this.listData.map(e => { |
||||
e.checked = false; |
||||
}); |
||||
row.checked = true; |
||||
this.checkedName = row.customerName; |
||||
this.checkedID = row.customerId; |
||||
}); |
||||
this.$emit("back", this.data); |
||||
} |
||||
}, |
||||
initData () { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
handleCurrentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
// checkbox交互 |
||||
checkboxChenge (row) { |
||||
this.listData.map(e => { |
||||
e.checked = false; |
||||
}); |
||||
row.checked = true; |
||||
this.checkedName = row.customerName; |
||||
this.checkedID = row.customerId; |
||||
|
||||
}, |
||||
clearSearch() { |
||||
}, |
||||
clearSearch () { |
||||
|
||||
this.getData(); |
||||
} |
||||
this.getData(); |
||||
} |
||||
} |
||||
|
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.mag { |
||||
margin-right: 20px; |
||||
margin-right: 20px; |
||||
} |
||||
|
||||
/deep/ .el-checkbox__inner { |
||||
border-radius: 50%; |
||||
width: 19px; |
||||
height: 19px; |
||||
border-radius: 50%; |
||||
width: 19px; |
||||
height: 19px; |
||||
} |
||||
|
||||
/deep/ .el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner { |
||||
background: #FFF; |
||||
/deep/ .el-checkbox__input.is-checked .el-checkbox__inner, |
||||
.el-checkbox__input.is-indeterminate .el-checkbox__inner { |
||||
background: #FFF; |
||||
|
||||
} |
||||
|
||||
/deep/ .el-checkbox__inner::after { |
||||
transform: none; |
||||
transition: all .3s ease-in; |
||||
width: 0; |
||||
height: 0; |
||||
position: relative; |
||||
top: 50%; |
||||
left: 50%; |
||||
transform: translate(-46%, -48%); |
||||
border-radius: 50%; |
||||
transform: none; |
||||
transition: all .3s ease-in; |
||||
width: 0; |
||||
height: 0; |
||||
position: relative; |
||||
top: 50%; |
||||
left: 50%; |
||||
transform: translate(-46%, -48%); |
||||
border-radius: 50%; |
||||
} |
||||
|
||||
/deep/ .el-checkbox__input.is-checked .el-checkbox__inner::after { |
||||
width: 13px; |
||||
height: 13px; |
||||
background: #9278FF; |
||||
position: relative; |
||||
top: 50%; |
||||
left: 50%; |
||||
transform: translate(-46%, -48%); |
||||
display: block; |
||||
border-radius: 50%; |
||||
transition: all .3s ease-in; |
||||
border: 0; |
||||
width: 13px; |
||||
height: 13px; |
||||
background: #9278FF; |
||||
position: relative; |
||||
top: 50%; |
||||
left: 50%; |
||||
transform: translate(-46%, -48%); |
||||
display: block; |
||||
border-radius: 50%; |
||||
transition: all .3s ease-in; |
||||
border: 0; |
||||
} |
||||
|
||||
/deep/ .el-checkbox__input { |
||||
line-height: 0; |
||||
line-height: 0; |
||||
} |
||||
</style> |
@ -1,273 +1,271 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole" v-auth="'/parner:小程序角色权限:新增角色'">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection" v-auth="'/parner:小程序角色权限:批量删除'">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)" v-auth="'/parner:小程序角色权限:查看'">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)" v-auth="'/parner:小程序角色权限:编辑'">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)" v-auth="'/parner:小程序角色权限:删除'">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole" v-auth="'/parner:小程序角色权限:新增角色'">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection" v-auth="'/parner:小程序角色权限:批量删除'">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree |
||||
ref="per" |
||||
:data="permissions" |
||||
show-checkbox |
||||
default-expand-all |
||||
node-key="id" |
||||
:default-expanded-keys="checkedIds" |
||||
:default-checked-keys="checkedIds" |
||||
:props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
<el-table :data="listData" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" |
||||
:row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" |
||||
:reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" |
||||
show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)" v-auth="'/parner:小程序角色权限:查看'">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)" |
||||
v-auth="'/parner:小程序角色权限:编辑'">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" |
||||
@click="handleDelete(scope.row)" v-auth="'/parner:小程序角色权限:删除'">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" |
||||
@close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree ref="per" :data="permissions" show-checkbox default-expand-all node-key="id" |
||||
:default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
platformId: 4, |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
data () { |
||||
return { |
||||
platformId: 4, |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.getData() |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
// platformId 合伙人为4,具体看setting.js;port: pc端为0、小程序端为1 |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}&port=1`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => { }); |
||||
}, |
||||
currentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
handleDelete (row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { }); |
||||
}).catch(() => { }); |
||||
}, |
||||
mounted() { |
||||
this.getData() |
||||
getRowKeys (row) { |
||||
return row.id; |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
// platformId 合伙人为4,具体看setting.js;port: pc端为0、小程序端为1 |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}&port=1`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => {}); |
||||
}, |
||||
currentChange(val) { |
||||
this.page = val; |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection () { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
}).catch(() => {}); |
||||
}, |
||||
getRowKeys(row) { |
||||
return row.id; |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection() { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
if(this.multipleSelection.length === this.listData.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => {}); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable(row, index){ |
||||
let boolean = true; |
||||
if(row.roleName == '超级管理员'){ |
||||
boolean = false |
||||
}else{ |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole() { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer(row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${this.platformId}&port=1`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
}).catch(res => { }); |
||||
if (this.multipleSelection.length === this.listData.length && this.page > 1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => { }); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable (row, index) { |
||||
let boolean = true; |
||||
if (row.roleName == '超级管理员') { |
||||
boolean = false |
||||
} else { |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole () { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer (row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${this.platformId}&port=1`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
|
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole() { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer(data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail(row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole(row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole(row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData() { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId: this.platformId, |
||||
port: 1 |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole () { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer (data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail (row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole (row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole (row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData () { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId: this.platformId, |
||||
port: 1 |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
<style lang="scss" scoped></style> |
@ -1,272 +1,270 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole" v-auth="'/parner:pc角色权限:新增角色'">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection" v-auth="'/parner:pc角色权限:批量删除'">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)" v-auth="'/parner:pc角色权限:查看'">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)" v-auth="'/parner:pc角色权限:编辑'">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)" v-auth="'/parner:pc角色权限:删除'">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole" v-auth="'/parner:pc角色权限:新增角色'">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection" v-auth="'/parner:pc角色权限:批量删除'">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree |
||||
ref="per" |
||||
:data="permissions" |
||||
show-checkbox |
||||
default-expand-all |
||||
node-key="id" |
||||
:default-expanded-keys="checkedIds" |
||||
:default-checked-keys="checkedIds" |
||||
:props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
<el-table :data="listData" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" |
||||
:row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" |
||||
:reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" |
||||
show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)" v-auth="'/parner:pc角色权限:查看'">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)" |
||||
v-auth="'/parner:pc角色权限:编辑'">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" |
||||
@click="handleDelete(scope.row)" v-auth="'/parner:pc角色权限:删除'">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" |
||||
@close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree ref="per" :data="permissions" show-checkbox default-expand-all node-key="id" |
||||
:default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
platformId: 4, |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
data () { |
||||
return { |
||||
platformId: 4, |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.getData() |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
// platformId 合伙人为4,具体看setting.js; |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}&port=0`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => { }); |
||||
}, |
||||
currentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
handleDelete (row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { }); |
||||
}).catch(() => { }); |
||||
}, |
||||
mounted() { |
||||
this.getData() |
||||
getRowKeys (row) { |
||||
return row.id; |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
// platformId 合伙人为4,具体看setting.js; |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}&port=0`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => {}); |
||||
}, |
||||
currentChange(val) { |
||||
this.page = val; |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection () { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
}).catch(() => {}); |
||||
}, |
||||
getRowKeys(row) { |
||||
return row.id; |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection() { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
if(this.multipleSelection.length === this.listData.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => {}); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable(row, index){ |
||||
let boolean = true; |
||||
if(row.roleName == '超级管理员'){ |
||||
boolean = false |
||||
}else{ |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole() { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer(row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${this.platformId}`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
}).catch(res => { }); |
||||
if (this.multipleSelection.length === this.listData.length && this.page > 1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => { }); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable (row, index) { |
||||
let boolean = true; |
||||
if (row.roleName == '超级管理员') { |
||||
boolean = false |
||||
} else { |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole () { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer (row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${this.platformId}`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
|
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole() { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer(data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail(row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole(row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole(row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData() { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId: this.platformId, |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole () { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer (data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail (row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole (row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole (row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData () { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId: this.platformId, |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
<style lang="scss" scoped></style> |
@ -1,323 +1,332 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<div class="per_title" v-preventReClick @click="goback()"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">系统服务器地址配置</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" round class="mag" v-preventReClick @click="saveAdd('form')">确定</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<div class="per_title" v-preventReClick @click="goback()"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">系统服务器地址配置</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" round class="mag" v-preventReClick @click="saveAdd('form')">确定</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20 user_header"> |
||||
<p class="addhr_tag"></p> |
||||
<span>系统信息</span> |
||||
</div> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20 user_header"> |
||||
<p class="addhr_tag"></p> |
||||
<span>系统信息</span> |
||||
</div> |
||||
|
||||
<div> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" class="flex-end-around"> |
||||
<el-col :span="6"> |
||||
<el-form-item prop="systemName" label="系统名称"> |
||||
<el-input v-model="form.systemName" placeholder="请输入系统名称"></el-input> |
||||
</el-form-item> |
||||
<div> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" class="flex-end-around"> |
||||
<el-col :span="6"> |
||||
<el-form-item prop="systemName" label="系统名称"> |
||||
<el-input v-model="form.systemName" placeholder="请输入系统名称"></el-input> |
||||
</el-form-item> |
||||
|
||||
<el-form-item prop="systemType" label="系统类型"> |
||||
<el-select v-model="form.systemType" clearable placeholder="请选择系统类型"> |
||||
<el-option v-for="(item,index) in systemTypeList" :key="index" :label="item.name" :value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-form-item prop="systemType" label="系统类型"> |
||||
<el-select v-model="form.systemType" clearable placeholder="请选择系统类型"> |
||||
<el-option v-for="(item, index) in systemTypeList" :key="index" :label="item.name" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
|
||||
|
||||
<el-col :span="6" style="margin-left: 60px;"> |
||||
<el-form-item prop="systemAttribution" label="系统归属"> |
||||
<el-select v-model="form.systemAttribution" clearable placeholder="请选择系统归属"> |
||||
<el-option v-for="(item,index) in systemList" :key="index" :label="item.name" :value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
<el-col :span="6" style="margin-left: 60px;"> |
||||
<el-form-item prop="systemAttribution" label="系统归属"> |
||||
<el-select v-model="form.systemAttribution" clearable placeholder="请选择系统归属"> |
||||
<el-option v-for="(item, index) in systemList" :key="index" :label="item.name" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="mgb20 flex-between"> |
||||
<div class="flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>地址列表</span> |
||||
</div> |
||||
<div> |
||||
<el-input placeholder="请输入系统名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</div> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" stripe :span-method="SpanMethod" header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="storeName" label="后台" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text">编辑</el-button> |
||||
<el-button type="text">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="pages"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="mgb20 flex-between"> |
||||
<div class="flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>地址列表</span> |
||||
</div> |
||||
<div> |
||||
<el-input placeholder="请输入系统名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</div> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" :span-method="SpanMethod" header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="storeName" label="后台" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text">编辑</el-button> |
||||
<el-button type="text">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="pages"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<!-- 选择IP --> |
||||
<el-dialog :visible.sync="ipVisible" width="50%" center> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>客户列表</span> |
||||
<!-- 选择IP --> |
||||
<el-dialog :visible.sync="ipVisible" width="50%" center> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>客户列表</span> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
<el-table :data="permissionData" class="table" stripe header-align="center"> |
||||
<el-table-column prop="id" label="序号" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="age" label="服务器名称" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="IP" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="选择" align="center"> |
||||
<template slot-scope="scope"> |
||||
<i class="el-icon-success radio_icon"></i> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="ipVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="editSure('teacherForm')">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="端口" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div class="tab_temp"> |
||||
<div class="flex-center"> |
||||
<label>内网:</label> |
||||
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input> |
||||
</div> |
||||
<div class="flex-center mar10"> |
||||
<label>外网:</label> |
||||
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="选择" align="center"> |
||||
<template slot-scope="scope"> |
||||
<i class="el-icon-success radio_icon"></i> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="ipVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="editSure('teacherForm')">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data (){ |
||||
return { |
||||
form: { |
||||
systemName: '', |
||||
systemType: '', |
||||
systemAttribution: '' |
||||
}, |
||||
rules: { |
||||
systemName:[ |
||||
{ required: true, message: '请输入系统名称', trigger: 'blur' } |
||||
], |
||||
systemType:[ |
||||
{ required: true, message: '请选择系统类型', trigger: 'change' } |
||||
], |
||||
systemAttribution:[ |
||||
{ required: true, message: '请选择系统归属', trigger: 'change' } |
||||
] |
||||
}, |
||||
permissionData: [{ |
||||
id: 1, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '10.20.202.1', |
||||
extranet: '10.20.202.1' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
swtich: true, |
||||
Intranet: '', |
||||
extranet: '' |
||||
}], |
||||
pages: 1, |
||||
ipVisible: false, |
||||
educationDegreeList: [{ |
||||
name: '研究生及以上', |
||||
value: 1 |
||||
}], |
||||
systemList: [{ |
||||
name: '外部产品', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
name: '内部系统', |
||||
value: 0 |
||||
}], |
||||
systemTypeList: [{ |
||||
name: '工具', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
name: '实训', |
||||
value: 2 |
||||
}, |
||||
{ |
||||
name: '网站', |
||||
value: 3 |
||||
}], |
||||
configId : this.$store.state.configId, |
||||
keyword: '' |
||||
} |
||||
}, |
||||
mounted(){ |
||||
if(this.configId){ |
||||
this.getData() |
||||
} |
||||
}, |
||||
methods: { |
||||
getData(){ |
||||
let data = { |
||||
systemId: this.configId |
||||
} |
||||
this.$get(this.api.queryServiceConfigDetails,data).then((res) => { |
||||
this.form = { |
||||
systemName: res.message[0].systemName, |
||||
systemType: res.message[0].systemType, |
||||
systemAttribution: res.message[0].systemAttribution, |
||||
} |
||||
}).catch((res) => { |
||||
}) |
||||
}, |
||||
saveAdd(){ |
||||
let data = { |
||||
systemId: this.configId, |
||||
systemName: this.form.systemName, |
||||
systemType: this.form.systemType, |
||||
systemAttribution: this.form.systemAttribution, |
||||
} |
||||
if(this.configId){ |
||||
this.$post(this.api.updateServiceConfig,data).then((res) => { |
||||
this.$message.success('编辑成功'); |
||||
this.goback() |
||||
}).catch((res) => { |
||||
}) |
||||
}else{ |
||||
this.$post(this.api.updateServiceConfig,data).then((res) => { |
||||
this.$message.success('添加成功'); |
||||
this.goback() |
||||
}).catch((res) => { |
||||
}) |
||||
} |
||||
}, |
||||
SpanMethod({ row, column, rowIndex, columnIndex }) { |
||||
if (rowIndex % 2 === 0) { |
||||
if (columnIndex === 6) { |
||||
if(!row.Intranet){ |
||||
return [1, 2]; |
||||
} |
||||
} |
||||
// else if (columnIndex === 1) { |
||||
// return [0, 0]; |
||||
// } |
||||
} |
||||
}, |
||||
chooseIp(){ |
||||
this.ipVisible = true |
||||
}, |
||||
goback(){ |
||||
this.$router.go(-1) |
||||
} |
||||
export default { |
||||
data () { |
||||
return { |
||||
form: { |
||||
systemName: '', |
||||
systemType: '', |
||||
systemAttribution: '' |
||||
}, |
||||
rules: { |
||||
systemName: [ |
||||
{ required: true, message: '请输入系统名称', trigger: 'blur' } |
||||
], |
||||
systemType: [ |
||||
{ required: true, message: '请选择系统类型', trigger: 'change' } |
||||
], |
||||
systemAttribution: [ |
||||
{ required: true, message: '请选择系统归属', trigger: 'change' } |
||||
] |
||||
}, |
||||
permissionData: [{ |
||||
id: 1, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
payamount: '700d12h1min', |
||||
swtich: true, |
||||
Intranet: '10.20.202.1', |
||||
extranet: '10.20.202.1' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
age: '小额贷系统', |
||||
storeName: '1个月', |
||||
total: '2019.01.02 11:00', |
||||
payamount: '2019.01.02 11:00', |
||||
swtich: true, |
||||
Intranet: '', |
||||
extranet: '' |
||||
}], |
||||
pages: 1, |
||||
ipVisible: false, |
||||
educationDegreeList: [{ |
||||
name: '研究生及以上', |
||||
value: 1 |
||||
}], |
||||
systemList: [{ |
||||
name: '外部产品', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
name: '内部系统', |
||||
value: 0 |
||||
}], |
||||
systemTypeList: [{ |
||||
name: '工具', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
name: '实训', |
||||
value: 2 |
||||
}, |
||||
{ |
||||
name: '网站', |
||||
value: 3 |
||||
}], |
||||
configId: this.$store.state.configId, |
||||
keyword: '' |
||||
} |
||||
}, |
||||
mounted () { |
||||
if (this.configId) { |
||||
this.getData() |
||||
} |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
let data = { |
||||
systemId: this.configId |
||||
} |
||||
this.$get(this.api.queryServiceConfigDetails, data).then((res) => { |
||||
this.form = { |
||||
systemName: res.message[0].systemName, |
||||
systemType: res.message[0].systemType, |
||||
systemAttribution: res.message[0].systemAttribution, |
||||
} |
||||
}).catch((res) => { |
||||
}) |
||||
}, |
||||
saveAdd () { |
||||
let data = { |
||||
systemId: this.configId, |
||||
systemName: this.form.systemName, |
||||
systemType: this.form.systemType, |
||||
systemAttribution: this.form.systemAttribution, |
||||
} |
||||
if (this.configId) { |
||||
this.$post(this.api.updateServiceConfig, data).then((res) => { |
||||
this.$message.success('编辑成功'); |
||||
this.goback() |
||||
}).catch((res) => { |
||||
}) |
||||
} else { |
||||
this.$post(this.api.updateServiceConfig, data).then((res) => { |
||||
this.$message.success('添加成功'); |
||||
this.goback() |
||||
}).catch((res) => { |
||||
}) |
||||
} |
||||
}, |
||||
SpanMethod ({ row, column, rowIndex, columnIndex }) { |
||||
if (rowIndex % 2 === 0) { |
||||
if (columnIndex === 6) { |
||||
if (!row.Intranet) { |
||||
return [1, 2]; |
||||
} |
||||
} |
||||
// else if (columnIndex === 1) { |
||||
// return [0, 0]; |
||||
// } |
||||
} |
||||
}, |
||||
chooseIp () { |
||||
this.ipVisible = true |
||||
}, |
||||
goback () { |
||||
this.$router.go(-1) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.border_lf{ |
||||
border-left: 1px dashed #eee; |
||||
padding: 0 60px; |
||||
.border_lf { |
||||
border-left: 1px dashed #eee; |
||||
padding: 0 60px; |
||||
} |
||||
.border_lf label{ |
||||
width: 120px; |
||||
|
||||
.border_lf label { |
||||
width: 120px; |
||||
} |
||||
.pad_none{ |
||||
padding: 0 0 0 60px; |
||||
|
||||
.pad_none { |
||||
padding: 0 0 0 60px; |
||||
} |
||||
.mar_input{ |
||||
margin-right: 80px; |
||||
|
||||
.mar_input { |
||||
margin-right: 80px; |
||||
} |
||||
.marb30{ |
||||
margin-bottom: 30px; |
||||
|
||||
.marb30 { |
||||
margin-bottom: 30px; |
||||
} |
||||
.tab_temp label{ |
||||
width: 60px; |
||||
|
||||
.tab_temp label { |
||||
width: 60px; |
||||
} |
||||
.mar10{ |
||||
margin-top: 10px; |
||||
|
||||
.mar10 { |
||||
margin-top: 10px; |
||||
} |
||||
.radio_icon{ |
||||
font-size: 26px; |
||||
color: #9278FF; |
||||
|
||||
.radio_icon { |
||||
font-size: 26px; |
||||
color: #9278FF; |
||||
} |
||||
</style> |
@ -1,270 +1,267 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入字典名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入字典名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="primary" round @click="addRole">新增角色</el-button> |
||||
<el-button type="primary" round @click="delAllSelection">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree |
||||
ref="per" |
||||
:data="permissions" |
||||
show-checkbox |
||||
default-expand-all |
||||
node-key="id" |
||||
:default-expanded-keys="checkedIds" |
||||
:default-checked-keys="checkedIds" |
||||
:props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
<el-table :data="listData" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" |
||||
:row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" |
||||
:reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" |
||||
show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showRole(scope.row)">查看</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button> |
||||
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" |
||||
@click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" |
||||
@close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree ref="per" :data="permissions" show-checkbox default-expand-all node-key="id" |
||||
:default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
data () { |
||||
return { |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
// this.getData(); |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=1`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => { }); |
||||
}, |
||||
currentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
handleDelete (row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { }); |
||||
}).catch(() => { }); |
||||
}, |
||||
mounted() { |
||||
// this.getData(); |
||||
getRowKeys (row) { |
||||
return row.id; |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=1`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => {}); |
||||
}, |
||||
currentChange(val) { |
||||
this.page = val; |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection () { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
}).catch(() => {}); |
||||
}, |
||||
getRowKeys(row) { |
||||
return row.id; |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection() { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
if(this.multipleSelection.length === this.listData.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => {}); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable(row, index){ |
||||
let boolean = true; |
||||
if(row.roleName == '超级管理员'){ |
||||
boolean = false |
||||
}else{ |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole() { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer(row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
}).catch(res => { }); |
||||
if (this.multipleSelection.length === this.listData.length && this.page > 1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => { }); |
||||
} else { |
||||
this.$message.error("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable (row, index) { |
||||
let boolean = true; |
||||
if (row.roleName == '超级管理员') { |
||||
boolean = false |
||||
} else { |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole () { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer (row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
|
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole() { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer(data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail(row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole(row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole(row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData() { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId:1, |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole () { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer (data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail (row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole (row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole (row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData () { |
||||
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); |
||||
if (!this.form.remark) return this.$message.warning("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId: 1, |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
this.$message.success("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => { }); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
<style lang="scss" scoped></style> |
@ -1,94 +1,93 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入平台名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入平台名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id"> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="name" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column prop="versionName" label="最新版本名称" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="最新版本状态" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.draft ? '草稿箱' : '已发布' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="updateTime" label="最近编辑" align="center"></el-table-column> |
||||
<el-table-column prop="versionNum" label="版本数" align="center"></el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="toManage(scope.row)" v-auth="'/system:日志更新:管理'">管理</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
<el-table :data="listData" class="table" ref="table" header-align="center" row-key="id"> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="name" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column prop="versionName" label="最新版本名称" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="最新版本状态" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.draft ? '草稿箱' : '已发布' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="updateTime" label="最近编辑" align="center"></el-table-column> |
||||
<el-table-column prop="versionNum" label="版本数" align="center"></el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="toManage(scope.row)" v-auth="'/system:日志更新:管理'">管理</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from '@/setting' |
||||
export default { |
||||
data() { |
||||
return { |
||||
keyword: "", |
||||
searchTimer: null, |
||||
platformList: Setting.platformList, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listDataAll: [], |
||||
listData: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
const list = this.listData |
||||
this.listData = val ? list.filter(e => e.name.includes(val)) : this.listDataAll |
||||
this.total = this.listData.length |
||||
}, 500); |
||||
} |
||||
data () { |
||||
return { |
||||
keyword: "", |
||||
searchTimer: null, |
||||
platformList: Setting.platformList, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listDataAll: [], |
||||
listData: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
const list = this.listData |
||||
this.listData = val ? list.filter(e => e.name.includes(val)) : this.listDataAll |
||||
this.total = this.listData.length |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.getData() |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
this.$get(`${this.api.logManagementList}?search=${this.keyword}`).then(res => { |
||||
const list = res.logManagementListVo |
||||
const platformList = this.platformList |
||||
list.map(e => { |
||||
const item = platformList.find(n => n.id === e.platformId) |
||||
if (item) e.name = item.name |
||||
}) |
||||
this.listDataAll = res.logManagementListVo |
||||
this.listData = res.logManagementListVo |
||||
this.total = this.listData.length |
||||
}).catch(res => { }) |
||||
}, |
||||
mounted() { |
||||
this.getData() |
||||
currentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$get(`${this.api.logManagementList}?search=${this.keyword}`).then(res => { |
||||
const list = res.logManagementListVo |
||||
const platformList = this.platformList |
||||
list.map(e => { |
||||
const item = platformList.find(n => n.id === e.platformId) |
||||
if (item) e.name = item.name |
||||
}) |
||||
this.listDataAll = res.logManagementListVo |
||||
this.listData = res.logManagementListVo |
||||
this.total = this.listData.length |
||||
}).catch(res => {}) |
||||
}, |
||||
currentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
toManage(row) { |
||||
this.$router.push(`/manageLog?platformId=${row.platformId}`) |
||||
} |
||||
toManage (row) { |
||||
this.$router.push(`/manageLog?platformId=${row.platformId}`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
<style lang="scss" scoped></style> |
@ -1,187 +1,187 @@ |
||||
<template> |
||||
<!-- 分类管理 --> |
||||
<div> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<!-- 分类管理 --> |
||||
<div> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
|
||||
</ul> |
||||
<div style="margin-top: 24px"> |
||||
<el-button v-auth="'分类管理:新增'" type="primary" round @click="addClass">新增</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="list" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="classificationName" label="课程分类名称"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="300"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-auth="'分类管理:修改'" type="text" @click="editClass(scope.row)">修改</el-button> |
||||
<el-divider v-auth="'分类管理:修改'" direction="vertical"></el-divider> |
||||
<el-button v-auth="'分类管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="!curRow.id ? '添加分类' : '编辑分类'" :visible.sync="classVisible" width="400px" :close-on-click-modal="false" @close="closeColumn"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<el-input placeholder="分类名称" v-model="classificationName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="classVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="classSubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</ul> |
||||
<div style="margin-top: 24px"> |
||||
<el-button v-auth="'分类管理:新增'" type="primary" round @click="addClass">新增</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="list" class="table" header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="classificationName" label="课程分类名称"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="300"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-auth="'分类管理:修改'" type="text" @click="editClass(scope.row)">修改</el-button> |
||||
<el-divider v-auth="'分类管理:修改'" direction="vertical"></el-divider> |
||||
<el-button v-auth="'分类管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" |
||||
:current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="!curRow.id ? '添加分类' : '编辑分类'" :visible.sync="classVisible" width="400px" |
||||
:close-on-click-modal="false" @close="closeColumn"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<el-input placeholder="分类名称" v-model="classificationName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="classVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="classSubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import Setting from '@/setting' |
||||
export default { |
||||
name: "sortManagement", |
||||
data() { |
||||
return { |
||||
list: [], |
||||
multipleSelection: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
classVisible: false, |
||||
curRow: {}, |
||||
classificationName: "", |
||||
nameRepeat: false |
||||
}; |
||||
name: "sortManagement", |
||||
data () { |
||||
return { |
||||
list: [], |
||||
multipleSelection: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
classVisible: false, |
||||
curRow: {}, |
||||
classificationName: "", |
||||
nameRepeat: false |
||||
}; |
||||
}, |
||||
watch: { |
||||
classificationName: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.nameChange(); |
||||
}, 100); |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
this.$post(this.api.listClassification, { |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
platformSource: Setting.platformSource |
||||
}).then(({ page }) => { |
||||
this.list = page.records |
||||
this.total = page.total |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
watch: { |
||||
classificationName: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.nameChange(); |
||||
}, 100); |
||||
} |
||||
handleDelete (row) { |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
this.$post(this.api.delClassification, [row.id]).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
mounted() { |
||||
this.getData(); |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$post(this.api.listClassification, { |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
platformSource: Setting.platformSource |
||||
}).then(({ page }) => { |
||||
this.list = page.records |
||||
this.total = page.total |
||||
closeColumn () { |
||||
this.classificationName = ""; |
||||
this.curRow = {}; |
||||
}, |
||||
delAllData () { |
||||
if (this.multipleSelection.length != "") { |
||||
let newArr = this.multipleSelection; |
||||
let delList = newArr.map(item => { |
||||
return item.id; |
||||
}); |
||||
// 批量删除 |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
let data = delList.join(); |
||||
this.$del(this.api.deleteClassification, data).then(res => { |
||||
this.multipleSelection = []; |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
this.$post(this.api.delClassification, [row.id]).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
closeColumn() { |
||||
this.classificationName = ""; |
||||
this.curRow = {}; |
||||
}, |
||||
delAllData() { |
||||
if (this.multipleSelection.length != "") { |
||||
let newArr = this.multipleSelection; |
||||
let delList = newArr.map(item => { |
||||
return item.id; |
||||
}); |
||||
// 批量删除 |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
let data = delList.join(); |
||||
this.$del(this.api.deleteClassification, data).then(res => { |
||||
this.multipleSelection = []; |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
addClass() { |
||||
this.classVisible = true; |
||||
}, |
||||
editClass(row) { |
||||
this.curRow = row; |
||||
this.classificationName = row.classificationName; |
||||
this.classVisible = true; |
||||
}, |
||||
nameChange(val) { |
||||
const row = this.curRow |
||||
this.$post(this.api.checkRepeatClassification, { |
||||
id: row.id, |
||||
platformSource: Setting.platformSource, |
||||
classificationName: this.classificationName |
||||
}).then(res => { |
||||
this.nameRepeat = false |
||||
}).catch(res => { |
||||
this.nameRepeat = true |
||||
}) |
||||
}, |
||||
classSubmit() { |
||||
if (!this.classificationName) return util.errorMsg("请填写分类名称"); |
||||
if (this.nameRepeat) return util.errorMsg("当前分类已存在!"); |
||||
let data = { |
||||
classificationName: this.classificationName, |
||||
platformSource: Setting.platformSource |
||||
}; |
||||
if (this.curRow.id) { |
||||
data.id = this.curRow.id; |
||||
this.$post(this.api.updateClassification, data).then(res => { |
||||
util.successMsg("修改成功"); |
||||
this.classVisible = false; |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
} else { |
||||
this.$post(this.api.saveClassification, data).then(res => { |
||||
util.successMsg("添加成功"); |
||||
this.classVisible = false; |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
} |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleCurrentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
addClass () { |
||||
this.classVisible = true; |
||||
}, |
||||
editClass (row) { |
||||
this.curRow = row; |
||||
this.classificationName = row.classificationName; |
||||
this.classVisible = true; |
||||
}, |
||||
nameChange (val) { |
||||
const row = this.curRow |
||||
this.$post(this.api.checkRepeatClassification, { |
||||
id: row.id, |
||||
platformSource: Setting.platformSource, |
||||
classificationName: this.classificationName |
||||
}).then(res => { |
||||
this.nameRepeat = false |
||||
}).catch(res => { |
||||
this.nameRepeat = true |
||||
}) |
||||
}, |
||||
classSubmit () { |
||||
if (!this.classificationName) return util.errorMsg("请填写分类名称"); |
||||
if (this.nameRepeat) return util.errorMsg("当前分类已存在!"); |
||||
let data = { |
||||
classificationName: this.classificationName, |
||||
platformSource: Setting.platformSource |
||||
}; |
||||
if (this.curRow.id) { |
||||
data.id = this.curRow.id; |
||||
this.$post(this.api.updateClassification, data).then(res => { |
||||
util.successMsg("修改成功"); |
||||
this.classVisible = false; |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
} else { |
||||
this.$post(this.api.saveClassification, data).then(res => { |
||||
util.successMsg("添加成功"); |
||||
this.classVisible = false; |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
<style lang="scss" scoped></style> |
Loading…
Reference in new issue