Commit eba381c7 authored by 黄奎's avatar 黄奎

少价管理修改

parent b3299ace
<style>
</style>
<template>
<div class="flexOne">
<div class="query-box">
<ul>
<li>
<span><em>角色名称</em><el-input v-model='msg.Name' placeholder="请输入内容"></el-input></span>
</li>
<li>
<span><em>状态</em><el-select v-model='msg.Status' placeholder="不限">
<el-option label='不限' value=''></el-option>
<el-option label='正常' value='0'></el-option>
<el-option label='冻结' value='1'></el-option>
</el-select>
</span>
</li>
<!-- <li>
<span><em>版本</em><el-select v-model='msg.Versions_Id' placeholder="不限">
<el-option label='不限' value=''></el-option>
<el-option v-for='item in versions'
:key="item.Id"
:label="item.VersionsName"
:value="item.Id"
></el-option>
</el-select>
</span>
</li> -->
<li>
<input type="button" class="hollowFixedBtn" @click="resetPageIndex();getList()" value="查询" />
<input type="button" @click="outerVisible = true,dialogTitle='新增角色',resetForm('addMsg')" class="normalBtn" value="新增" />
</li>
</ul>
</div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="300">角色名称</th>
<th width="800">描述</th>
<th width="100">状态</th>
<!-- <th>版本名称</th> -->
<th>操作人</th>
<th>操作</th>
</tr>
<tr v-for="(item,index) in dataList">
<td>{{item.Name}}</td>
<td>{{item.Description}}</td>
<td>{{item.Status==0?'正常':'冻结'}}</td>
<!-- <td>{{item.VersionsName}}</td> -->
<td>{{item.EmName}}</td>
<td>
<el-row>
<el-tooltip class="item" effect="dark" content="修改" placement="top-start">
<el-button @click="outerVisible = true,dialogTitle='修改角色',updateData(item.Id)" type="primary" icon="el-icon-edit" circle></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="权限" placement="top-start">
<el-button @click="goUrl('permissionList',item.Id)" type="primary" icon="iconfont icon-quanxianguanli" circle></el-button>
</el-tooltip>
</el-row>
</td>
</tr>
</table>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper" :page-size=msg.pageSize :total=total>
</el-pagination>
<el-dialog custom-class='w450' :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" >
<el-form-item maxlength='50' label="角色名称" prop="Name">
<el-input class='w217' type="text" v-model="addMsg.Name" :placeholder="$t('pub.pleaseImport')"></el-input>
</el-form-item>
<!-- <el-form-item label="版本" prop="Versions_Id">
<el-select class='w217' v-model='addMsg.Versions_Id' placeholder="请选择">
<el-option v-for='item in versions' :key="item.Id" :label="item.VersionsName" :value="item.Id"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="状态" prop="Status">
<el-switch v-model="addMsg.Status" active-value="0" inactive-value="1"></el-switch>
</el-form-item>
<el-form-item label="描述" prop="Description">
<el-input maxlength='250' class='w217' type="textarea" v-model="addMsg.Description"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg'),getList()">{{$t('pub.cancelBtn')}}</button> &nbsp;
<button class="normalBtn" type="primary" @click="submitForm('addMsg')">{{$t('pub.saveBtn')}}</button>
</div>
</el-dialog>
</div>
<div class="flexOne">
<div class="query-box">
<ul>
<li>
<span><em>角色名称</em>
<el-input v-model='msg.Name' placeholder="请输入内容"></el-input>
</span>
</li>
<li>
<span><em>状态</em>
<el-select v-model='msg.Status' placeholder="不限">
<el-option label='不限' value=''></el-option>
<el-option label='正常' value='0'></el-option>
<el-option label='冻结' value='1'></el-option>
</el-select>
</span>
</li>
<li>
<input type="button" class="hollowFixedBtn" @click="resetPageIndex();getList()" value="查询" />
<input type="button" @click="outerVisible = true,dialogTitle='新增角色',resetForm('addMsg')" class="normalBtn"
value="新增" />
</li>
</ul>
</div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="300">角色名称</th>
<th width="800">描述</th>
<th width="100">状态</th>
<th>操作人</th>
<th>操作</th>
</tr>
<tr v-for="(item,index) in dataList">
<td>{{item.Name}}</td>
<td>{{item.Description}}</td>
<td>{{item.Status==0?'正常':'冻结'}}</td>
<td>{{item.EmName}}</td>
<td>
<el-row>
<el-tooltip class="item" effect="dark" content="修改" placement="top-start">
<el-button @click="outerVisible = true,dialogTitle='修改角色',updateData(item.Id)" type="primary" icon="el-icon-edit"
circle></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="权限" placement="top-start">
<el-button @click="goUrl('permissionList',item.Id)" type="primary" icon="iconfont icon-quanxianguanli"
circle></el-button>
</el-tooltip>
</el-row>
</td>
</tr>
</table>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper"
:page-size=msg.pageSize :total=total>
</el-pagination>
<el-dialog custom-class='w450' :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px">
<el-form-item maxlength='50' label="角色名称" prop="Name">
<el-input class='w217' type="text" v-model="addMsg.Name" :placeholder="$t('pub.pleaseImport')"></el-input>
</el-form-item>
<el-form-item label="状态" prop="Status">
<el-switch v-model="addMsg.Status" active-value="0" inactive-value="1"></el-switch>
</el-form-item>
<el-form-item label="描述" prop="Description">
<el-input maxlength='250' class='w217' type="textarea" v-model="addMsg.Description"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg'),getList()">{{$t('pub.cancelBtn')}}</button>
&nbsp;
<button class="normalBtn" type="primary" @click="submitForm('addMsg')">{{$t('pub.saveBtn')}}</button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
switchValue:'1',
dialogTitle: '',
insideDialogTxt: '保存成功!',
outerVisible: false,
innerVisible: false,
isRight:true,
versions: [],
total: 0,
currentPage: 1,
dataList: [],
msg: {
pageIndex: 1,
pageSize: 15,
Status: '0',
Name: '',
},
addMsg:{
Id:'0',
Name:'',
Description:'',
Status:'0',
},
rules:{
Name:[
{ required: true, message: '请输入名称', trigger: 'blur' }
],
Status:[
{ required: false, message: '', trigger: 'change' }
],
Description:[
{ required: false, message: '请输入描述', trigger: 'change' }
],
},
verSionMsg: {
Status: 0
},
}
},
mounted() {
// this.msg.Versions_Id = this.$route.query.id
this.getList()
},
methods: {
getList() { //获取列表数据
this.apipost("admin_get_RoleGetPageList", this.msg, res => {
if(res.data.resultCode==1){
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
console.log(this.dataList)
}else{}
}, err => {})
},
getVersion() { //获取版本信息
this.apipost('admin_get_SysVersionsGetList', this.verSionMsg, res => {
this.versions = res.data.data;
//console.log(this.versions)
}, err => {
})
},
addData(){ //添加角色
this.apipost("admin_post_RoleSet",this.addMsg,res=>{
if(res.data.resultCode==1)
{
this.$message.success(res.data.message)
this.outerVisible=false;
this.getList()
this.resetForm('addMsg');
}else{
this.$message.error(res.data.message)
}
},err=>{})
},
updateData(id){ //修改角色
this.addMsg.Id=id;
this.apipost('admin_get_RoleGet',{RoleId:id},res=>{
if(res.data.resultCode==1){
console.log(res.data.data)
this.addMsg.Name = res.data.data.Name
this.addMsg.Description = res.data.data.Description
// this.addMsg.Versions_Id = res.data.data.Versions_Id
this.addMsg.Status = res.data.data.Status.toString();
}else{}
},err=>{})
// this.addMsg = this.dataList[index]
// this.addMsg.Status = this.dataList[index].Status.toString();
},
deleteData(id){
this.apipost('admin_post_RoleRemove', {RoleId:id}, res => {
if(res.data.resultCode==1){
this.getList()
}else{
alert(res.data.message)
}
}, err => {})
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
resetPageIndex() {
this.msg.pageIndex = 1;
this.currentPage = 1
},
goUrl(name,id){
this.$router.push({ name: name,query:{"id":id,blank:'y',tab:'权限设置'}})
},
submitForm(addMsg) {//提交创建、修改表单
this.$refs[addMsg].validate((valid) => {
if (valid) {
this.addData();
} else {
return false;
}
});
},
closeChangeMachie(done){//弹出框关闭初始化弹框内表单
done();
this.resetForm('addMsg');
},
resetForm(formName) {//弹出框取消 初始化谈框内表单
this.addMsg.Id='0';
this.addMsg.Status='0';
this.$refs[formName].resetFields();
}
}
}
export default {
data() {
return {
switchValue: '1',
dialogTitle: '',
insideDialogTxt: '保存成功!',
outerVisible: false,
innerVisible: false,
isRight: true,
versions: [],
total: 0,
currentPage: 1,
dataList: [],
msg: {
pageIndex: 1,
pageSize: 15,
Status: '0',
Name: '',
},
addMsg: {
Id: '0',
Name: '',
Description: '',
Status: '0',
},
rules: {
Name: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}],
Status: [{
required: false,
message: '',
trigger: 'change'
}],
Description: [{
required: false,
message: '请输入描述',
trigger: 'change'
}],
},
verSionMsg: {
Status: 0
},
}
},
mounted() {
this.getList()
},
methods: {
getList() { //获取列表数据
this.apipost("admin_get_RoleGetPageList", this.msg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {}
}, err => {})
},
getVersion() { //获取版本信息
this.apipost('admin_get_SysVersionsGetList', this.verSionMsg, res => {
this.versions = res.data.data;
}, err => {})
},
addData() { //添加角色
this.apipost("admin_post_RoleSet", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.$message.success(res.data.message)
this.outerVisible = false;
this.getList()
this.resetForm('addMsg');
} else {
this.$message.error(res.data.message)
}
}, err => {})
},
updateData(id) { //修改角色
this.addMsg.Id = id;
this.apipost('admin_get_RoleGet', {
RoleId: id
}, res => {
if (res.data.resultCode == 1) {
this.addMsg.Name = res.data.data.Name
this.addMsg.Description = res.data.data.Description
this.addMsg.Status = res.data.data.Status.toString();
} else {}
}, err => {})
},
deleteData(id) {
this.apipost('admin_post_RoleRemove', {
RoleId: id
}, res => {
if (res.data.resultCode == 1) {
this.getList()
} else {
alert(res.data.message)
}
}, err => {})
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
resetPageIndex() {
this.msg.pageIndex = 1;
this.currentPage = 1
},
goUrl(name, id) {
this.$router.push({
name: name,
query: {
"id": id,
blank: 'y',
tab: '权限设置'
}
})
},
submitForm(addMsg) { //提交创建、修改表单
this.$refs[addMsg].validate((valid) => {
if (valid) {
this.addData();
} else {
return false;
}
});
},
closeChangeMachie(done) { //弹出框关闭初始化弹框内表单
done();
this.resetForm('addMsg');
},
resetForm(formName) { //弹出框取消 初始化谈框内表单
this.addMsg.Id = '0';
this.addMsg.Status = '0';
this.$refs[formName].resetFields();
}
}
}
</script>
\ No newline at end of file
<style>
.LM_mainDiv{
overflow-y:auto;
}
.LP_table{
.LM_mainDiv {
overflow-y: auto;
}
.LP_table {
margin-top: 10px;
background-color: #fff;
border-top: 1px solid #d1d1d1;
border-left: 1px solid #d1d1d1;
border-right: 1px solid #d1d1d1;
font-size: 14px;
}
.LP_table tr{
height:40px;
}
.LP_table tr th{
border-bottom:1px solid #d1d1d1;
border-right:1px solid #d1d1d1;
}
.LP_table tr {
height: 40px;
}
.LP_table tr th {
border-bottom: 1px solid #d1d1d1;
border-right: 1px solid #d1d1d1;
position: relative;
background-color: #E6E6E6;
}
th[class=first]:before{
}
th[class=first]:before {
content: "";
position: absolute;
width: 1px;
height:252px;/*这里需要自己调整,根据td的宽度和高度*/
top:0;
left:0;
height: 252px;
/*这里需要自己调整,根据td的宽度和高度*/
top: 0;
left: 0;
background-color: #d1d1d1;
display: block;
transform: rotate(-81deg);/*这里需要自己调整,根据线的位置*/
transform: rotate(-81deg);
/*这里需要自己调整,根据线的位置*/
transform-origin: top;
}
}
.LP_table td{
.LP_table td {
border-bottom: 1px solid #d1d1d1;
border-right: 1px solid #d1d1d1;
text-align: center;
padding: 5px;
min-width: 250px;
}
.LP_table .el-button--primary{
padding:5px;
}
.Lp_role{
}
.LP_table .el-button--primary {
padding: 5px;
}
.Lp_role {
position: absolute;
top:15px;
left:30px;
}
.Lp_company{
top: 15px;
left: 30px;
}
.Lp_company {
position: absolute;
right:30px;
top:5px;
}
right: 30px;
top: 5px;
}
</style>
<template>
<div>
<div>
<div class="LM_mainDiv">
<table border="0" cellspacing="0" cellpadding="0" class="LP_table">
<tr>
<th class="first">
<span class="Lp_role">角色</span>
<span class="Lp_company">公司</span>
</th>
<th>成都</th>
<th>成都</th>
<th>成都</th>
<th>成都</th>
<th>成都</th>
<th>操作</th>
</tr>
<tr>
<td>
<el-select filterable :placeholder="$t('pub.pleaseSel')" class="w150">
<el-option label="不限" value="-1"></el-option>
</el-select>
</td>
<td>
<el-input class="w80" placeholder="金額"></el-input>
<el-input class="w80" placeholder="百分比"></el-input>
</td>
<td>
<el-input class="w80" placeholder="金額"></el-input>
<el-input class="w80" placeholder="百分比"></el-input>
</td>
<td>
<el-input class="w80" placeholder="金額"></el-input>
<el-input class="w80" placeholder="百分比"></el-input>
</td>
<td>
<el-input class="w80" placeholder="金額"></el-input>
<el-input class="w80" placeholder="百分比"></el-input>
</td>
<td>
<el-input class="w80" placeholder="金額"></el-input>
<el-input class="w80" placeholder="百分比"></el-input>
</td>
<td>
<el-tooltip class="item" effect="dark" content="保存" placement="top-start">
<el-button type="primary" icon="iconfont icon-baocun" circle></el-button>
</el-tooltip>
</td>
</tr>
</table>
<!--保存-->
<table border="0" cellspacing="0" cellpadding="0" class="LP_table">
<tr>
<th class="first">
<span class="Lp_role">角色</span>
<span class="Lp_company">公司</span>
</th>
<template v-for="item in BranchList">
<th>
{{item.BName}}
</th>
</template>
<th>
操作
</th>
</tr>
<tr v-for="(item,index) in PageData">
<td>
<el-select :placeholder="$t('pub.pleaseSel')" class="w150" v-model="item.RoleId">
<el-option label="不限" :value="0"></el-option>
<el-option v-for="item in RoleList" :label="item.Name" :value="item.Id" :key="item.Id"></el-option>
</el-select>
</td>
<template v-for="subItem in item.DetailExtList">
<td>
<el-input class="w80" placeholder="金額" v-model="subItem.LessMoney"></el-input>
<el-input class="w80" placeholder="百分比" v-model="subItem.LessPercent"></el-input>
</td>
</template>
<td>
<input type='button' class="normalBtn" @click="SaveLessPrice(item)" value="保存"></input>
<input type='button' class="normalBtn" @click="RemoveItem(item,index)" value="删除"></input>
</td>
</tr>
<tfoot>
<tr>
<td :colspan="1+BranchList.length">
<input type='button' class="normalBtn" @click="AddItem()" value="新增"></input>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
getCompanyList: [],
};
},
methods: {
},
mounted() {
export default {
data() {
return {
//分公司列表
BranchList: [],
qMsg: {
PageIndex: 1,
PageSize: 100
},
PageData: [],
//角色列表
RoleList: []
};
},
methods: {
AddItem() {
var obj = {
Id: 0,
RoleId: 0,
DetailExtList: [],
};
this.BranchList.forEach(item => {
obj.DetailExtList.push({
Id: 0,
ManagerId: 0,
RB_Branch_Id: item.Id,
LessMoney: 0,
LessPercent: 0
});
});
if (this.PageData == null) {
this.PageData = [];
}
this.PageData.push(obj);
},
//保存少价管理
SaveLessPrice(item) {
this.apipost(
"lessprice_post_Set", item,
res => {
if (res.data.resultCode == 1) {
this.Success("操作成功!");
this.GetList();
} else {
this.Error(res.data.message);
}
},
err => {}
);
},
//获取列表
GetList() {
this.apipost(
"lessprice_get_GetPageList", this.qMsg,
res => {
if (res.data.resultCode == 1) {
this.BranchList = res.data.data.branchList;
this.PageData = res.data.data.DataList.pageData;
}
},
err => {}
);
},
//获取列表
GetRoleList() {
this.apipost(
"admin_get_RoleGetList", {},
res => {
if (res.data.resultCode == 1) {
this.RoleList = res.data.data;
}
},
err => {}
);
},
//获取列表
RemoveItem(item, index) {
var that = this;
this.Confirm("是否删除此少价信息?", function () {
if (item.Id > 0) {
that.apipost(
"lessprice_post_Remove", {
ID: item.Id
},
res => {
if (res.data.resultCode == 1) {
that.Success("操作成功!");
that.GetList();
} else {
that.Error(res.data.message);
}
},
err => {}
);
} else {
that.PageData.splice(index, 1);
}
});
},
},
mounted() {
this.GetRoleList();
this.GetList();
},
};
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment