3 changed files with 439 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||
import request from '@/utils/request' |
|||
// 销售政策分页列表 已改
|
|||
export function listPage(data) { |
|||
return request({ |
|||
url: '/base/v1/basebrandletpricepowimit/listPage', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 回显
|
|||
export function fetchSid(data) { |
|||
return request({ |
|||
url: '/base/v1/basebrandletpricepowimit/fetchDetailsBySid/' + data, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增保存 已改
|
|||
export function save(data) { |
|||
return request({ |
|||
url: '/base/v1/basebrandletpricepowimit/save', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
} |
|||
|
@ -0,0 +1,187 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div> |
|||
<!--标题按钮部分开始--> |
|||
<div class="tab-header webtop"> |
|||
<!--标题--> |
|||
<div>{{ viewTitle }}</div> |
|||
<!--start 添加修改按钮--> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="save()">保存 |
|||
</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<!--标题按钮部分结束--> |
|||
<!--Start 新增修改部分--> |
|||
<div class="listconadd"> |
|||
<div class="titwu"><span>角色让价权限设置</span></div> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formadd"> |
|||
<el-row style="border-top: 1px solid #E0E3EB"> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>品牌</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><span>{{ formobj.brandName }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="4" class="tleftb"> |
|||
<span>分公司</span> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<el-form-item><span>{{ formobj.useOrgName }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title"> |
|||
<div>角色让价权限列表</div> |
|||
<div> |
|||
<el-button type="primary" size="mini" icon="el-icon-plus" class="btntopblueline" @click="handleAdd()">添加</el-button> |
|||
</div> |
|||
</div> |
|||
<el-table :key="tableKey" :data="formobj.baseRoleletpricepowimits" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column fixed prop="name" label="操作" width="100px" align="center" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button size="mini" type="danger" @click="dataDelete(scope.$index)">删除 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="角色名称" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-select v-model="scope.row.roleName" filterable placeholder="请选择" @change="roleChange($event, scope.row)"> |
|||
<el-option v-for="item in role_list" :key="item.sid" :label="item.name" :value="item.name"></el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="让价金额(元)" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.letPrice" clearable placeholder="" @keyup.native="oninput"/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { fetchSid, save } from '@/api/jichuxinxi/xiaoshourangjia' |
|||
import { roleList } from '@/api/dictcommons/dictcommons' |
|||
|
|||
export default { |
|||
name: 'xiaoshourangjiaAdd', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
index: 0, |
|||
tableKey: 0, |
|||
role_list: [], |
|||
// 表单数据 |
|||
formobj: { |
|||
sid: '', // 一条数据的sid |
|||
brandSid: '', |
|||
brandName: '', |
|||
useOrgSid: '', |
|||
useOrgName: '', |
|||
createOrgSid: '', |
|||
baseRoleletpricepowimits: [] |
|||
}, |
|||
rules: {}, |
|||
submitdisabled: false |
|||
} |
|||
}, |
|||
methods: { |
|||
init() { |
|||
roleList({}).then((res) => { |
|||
if (res.success) { |
|||
this.role_list = res.data |
|||
} |
|||
}) |
|||
}, |
|||
// 输入数字正则 |
|||
oninput(e) { |
|||
e.target.value = e.target.value.replace(/[^\d]/g, '') // 清除“数字”和“.”"-"以外的字符 |
|||
e.target.value = e.target.value.replace(/^00/, '0') // 开头不能有两个0 |
|||
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') { |
|||
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额 |
|||
console.log(e.target.value) |
|||
e.target.value = parseFloat(e.target.value) |
|||
} |
|||
}, |
|||
showEdit(row) { |
|||
this.init() |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.viewTitle = '【设置】角色让价权限' |
|||
console.log('编辑回显', row.sid) |
|||
fetchSid(row.sid).then((resp) => { |
|||
this.formobj = resp.data |
|||
}).catch((e) => { |
|||
this.formobj = row |
|||
}) |
|||
}, |
|||
// 明细表添加一行数据 |
|||
handleAdd() { |
|||
this.formobj.baseRoleletpricepowimits.push({ |
|||
roleSid: '', |
|||
roleName: '', |
|||
letPrice: '', |
|||
mainSid: '' |
|||
}) |
|||
}, |
|||
// 明细表删除一行数据 |
|||
dataDelete(index) { |
|||
this.formobj.baseRoleletpricepowimits.splice(index, 1) |
|||
}, |
|||
roleChange(value, row) { |
|||
const choose = this.role_list.filter((item) => item.name === value) |
|||
row.roleSid = choose[0].sid |
|||
}, |
|||
save() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
save(this.formobj).then((resp) => { |
|||
if (resp.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '保存成功' }) |
|||
this.handleReturn('true') |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} else { |
|||
return false |
|||
} |
|||
}) |
|||
}, |
|||
// 返回(===既判断) |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
// 表单数据 |
|||
this.formobj = { |
|||
sid: '', // 一条数据的sid |
|||
brandSid: '', |
|||
brandName: '', |
|||
useOrgSid: '', |
|||
useOrgName: '', |
|||
createOrgSid: '', |
|||
baseRoleletpricepowimits: [] |
|||
} |
|||
this.submitdisabled = false |
|||
this.$refs['form_obj'].resetFields() |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
.title { |
|||
padding: 7px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
</style> |
|||
|
@ -0,0 +1,219 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar view-title="设置品牌让价权限" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="100px" class="tab-header"> |
|||
<el-form-item label="分公司"> |
|||
<el-select v-model="listQuery.params.orgSid" placeholder="请选择" filterable @change="orgChange"> |
|||
<el-option v-for="item in userOrg_list" :key="item.sid" :label="item.name" :value="item.sid"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="品牌"> |
|||
<el-select v-model="listQuery.params.brandSid" placeholder="请选择" filterable> |
|||
<el-option v-for="item in carBrand_list" :key="item.sid" :label="item.brandName" :value="item.sid"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" size="small" icon="el-icon-search" @click="handleFilter">查询</el-button> |
|||
<el-button type="primary" size="small" icon="el-icon-refresh" @click="handleReset">重置</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="listtop"> |
|||
<div class="tit">品牌让价权限列表</div> |
|||
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<div class=""> |
|||
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%"> |
|||
<el-table-column width="60" label="序号" type="index" :index="indexMethod" align="center"/> |
|||
<el-table-column width="80" label="操作" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button size="small" type="primary" @click="handleUpdate(scope.row)">编辑</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="角色让价权限(元)" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.roleLetPrice }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="品牌名称" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.brandName }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="分公司" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.useOrgName }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<div class="pages"> |
|||
<div class="tit"/> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<xiaoshourangjiaAdd v-show="viewState == 2" ref="divadd" @doback="resetState" @reloadlist="getList" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { listPage } from '@/api/jichuxinxi/xiaoshourangjia' |
|||
import { selectOrgByLevel, brandDown } from '@/api/dictcommons/dictcommons' |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import xiaoshourangjiaAdd from './xiaoshourangjiaAdd' |
|||
|
|||
export default { |
|||
name: 'xiaoshourangjiaguanli', |
|||
components: { |
|||
Pagination, |
|||
pageye, |
|||
ButtonBar, |
|||
xiaoshourangjiaAdd |
|||
}, |
|||
data() { |
|||
return { |
|||
btndisabled: false, |
|||
btnList: [ |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
viewState: 1, // 1、列表 2、添加-车辆预订 3、编辑 4、查看 5、订金-订金收取 |
|||
// 查询 ----------- |
|||
userOrg_list: [], // 分公司 |
|||
carBrand_list: [], // 品牌 |
|||
tableKey: 0, |
|||
list: [], |
|||
sids: [], |
|||
FormLoading: false, |
|||
listLoading: false, |
|||
listQuery: { |
|||
current: 1, |
|||
size: 5, |
|||
total: 0, |
|||
params: { |
|||
orgSidPath: '', |
|||
brandSid: '', |
|||
orgSid: '' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
created() { |
|||
// 初始化变量 |
|||
this.init() |
|||
// 加载列表 |
|||
this.getList() |
|||
}, |
|||
methods: { |
|||
btnHandle(btnKey) { |
|||
console.log('XXXXXXXXXXXXXXX ' + btnKey) |
|||
switch (btnKey) { |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
init() { |
|||
selectOrgByLevel({ orgSidPath: window.sessionStorage.getItem('orgSidPath') }).then((resp) => { |
|||
if (resp.success) { |
|||
this.userOrg_list = resp.data |
|||
} |
|||
}) |
|||
}, |
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
// 查询列表信息 |
|||
getList() { |
|||
this.listLoading = true |
|||
this.listQuery.params.orgSidPath = window.sessionStorage.getItem('orgSidPath') |
|||
listPage(this.listQuery).then((response) => { |
|||
this.listLoading = false |
|||
if (response.success) { |
|||
this.list = response.data.records |
|||
this.listQuery.total = response.data.total |
|||
} else { |
|||
this.list = [] |
|||
this.listQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
// 查询按钮 |
|||
handleFilter() { |
|||
this.listQuery.current = 1 |
|||
this.getList() |
|||
}, |
|||
// 重置 |
|||
handleReset() { |
|||
this.listQuery = { |
|||
current: 1, |
|||
size: 5, |
|||
total: 0, |
|||
params: { |
|||
orgSidPath: '', |
|||
brandSid: '', |
|||
orgSid: '' |
|||
} |
|||
} |
|||
this.getList() |
|||
}, |
|||
orgChange(value) { |
|||
brandDown({ useOrg: value }).then((resp) => { |
|||
if (resp.success) { |
|||
this.carBrand_list = resp.data |
|||
} |
|||
}) |
|||
}, |
|||
// 编辑 |
|||
handleUpdate(row) { |
|||
this.viewState = 2 |
|||
this.$refs['divadd'].showEdit(row) |
|||
}, |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
</style> |
Loading…
Reference in new issue