3 changed files with 246 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
// 根据条件分页查询数据的列表 已改
|
||||
|
export function pagerList(data) { |
||||
|
return request({ |
||||
|
url: '/base/v1/basepurchasesystem/listPage', |
||||
|
data: data, |
||||
|
method: 'post', |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增保存 已改
|
||||
|
export function maintenance(data) { |
||||
|
return request({ |
||||
|
url: '/base/v1/basepurchasesystem/maintenance', |
||||
|
method: 'post', |
||||
|
params: data |
||||
|
}) |
||||
|
} |
@ -0,0 +1,217 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<!-- Start 列表页面 --> |
||||
|
<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-input v-model="listQuery.params.purchaseSystemName" clearable placeholder=""/> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div class="btn" style="text-align: center;"> |
||||
|
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button> |
||||
|
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</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 fixed width="80" label="序号" type="index" :index="indexMethod" align="center"/> |
||||
|
<el-table-column prop="useOrgName" label="分公司" align="center" /> |
||||
|
<el-table-column prop="purchaseSystemName" label="采购系统" align="center" /> |
||||
|
<el-table-column label="分摊比例(%)" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-input v-model="scope.row.shareProportion" @keyup.native="scope.row.shareProportion = getNumber(scope.row.shareProportion, 2)" clearable placeholder="" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" width="100" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button type="primary" size="mini" @click="toSave(scope.row)">保存</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<div class="pages"> |
||||
|
<!-- 翻页 --> |
||||
|
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { pagerList, maintenance } from '@/api/manufacturerrebates/maintenanceAllocation' |
||||
|
import Pagination from '@/components/pagination' |
||||
|
import pageye from '@/components/pagination/pageye' |
||||
|
import ButtonBar from '@/components/ButtonBar' |
||||
|
import { getOrgSidByPath } from '@/api/cheliang/dictcommons' |
||||
|
|
||||
|
export default { |
||||
|
name: 'MaintenanceAllocation', |
||||
|
components: { |
||||
|
Pagination, |
||||
|
pageye, |
||||
|
ButtonBar |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
btndisabled: false, |
||||
|
btnList: [ |
||||
|
{ |
||||
|
type: 'info', |
||||
|
size: 'small', |
||||
|
icon: 'cross', |
||||
|
btnKey: 'doClose', |
||||
|
btnLabel: '关闭' |
||||
|
} |
||||
|
], |
||||
|
isSearchShow: false, |
||||
|
searchxianshitit: '显示查询条件', |
||||
|
viewState: 1, |
||||
|
// 查询条件 ----------- |
||||
|
tableKey: 0, |
||||
|
list: [], |
||||
|
FormLoading: false, |
||||
|
listLoading: false, |
||||
|
listQuery: { |
||||
|
params: { |
||||
|
useOrgSid: '', |
||||
|
orgSidPath: '', |
||||
|
purchaseSystemName: '' |
||||
|
}, |
||||
|
current: 1, |
||||
|
size: 5, |
||||
|
total: 0 |
||||
|
}, |
||||
|
rules: {} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.init() |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.$refs['btnbar'].setButtonList(this.btnList) |
||||
|
}, |
||||
|
methods: { |
||||
|
init() { |
||||
|
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => { |
||||
|
if (resp.success) { |
||||
|
this.listQuery.params.useOrgSid = resp.data |
||||
|
this.getList() |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
getNumber(val, limit) { |
||||
|
val = val.replace(/[^0-9.]/g, '') // 保留数字 |
||||
|
val = val.replace(/^00/, '0.') // 开头不能有两个0 |
||||
|
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0. |
||||
|
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个 |
||||
|
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点 |
||||
|
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0 |
||||
|
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' |
||||
|
const reg = new RegExp(str) |
||||
|
if (limit === 0) { |
||||
|
// 不需要小数点 |
||||
|
val = val.replace(reg, '$1') |
||||
|
} else { |
||||
|
// 通过正则保留小数点后指定的位数 |
||||
|
val = val.replace(reg, '$1.$2') |
||||
|
} |
||||
|
return val |
||||
|
}, |
||||
|
// 搜索条件效果 |
||||
|
clicksearchShow() { |
||||
|
this.isSearchShow = !this.isSearchShow |
||||
|
if (this.isSearchShow) { |
||||
|
this.searchxianshitit = '隐藏查询条件' |
||||
|
} else { |
||||
|
this.searchxianshitit = '显示查询条件' |
||||
|
} |
||||
|
}, |
||||
|
btnHandle(btnKey) { |
||||
|
console.log('XXXXXXXXXXXXXXX ' + btnKey) |
||||
|
switch (btnKey) { |
||||
|
case 'doClose': |
||||
|
this.doClose() |
||||
|
break |
||||
|
default: |
||||
|
break |
||||
|
} |
||||
|
}, |
||||
|
// 序号 |
||||
|
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('defaultOrgPath') |
||||
|
pagerList(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 = { |
||||
|
params: { |
||||
|
useOrgSid: '', |
||||
|
orgSidPath: '', |
||||
|
purchaseSystemSid: '' |
||||
|
}, |
||||
|
current: 1, |
||||
|
size: 5, |
||||
|
total: 0 |
||||
|
} |
||||
|
this.init() |
||||
|
}, |
||||
|
toSave(row) { |
||||
|
if (row.shareProportion !== '') { |
||||
|
maintenance({ sid: row.sid, shareProportion: row.shareProportion }).then((res) => { |
||||
|
if (res.success) { |
||||
|
this.$message({ showClose: true, type: 'success', message: '操作成功' }) |
||||
|
this.getList() |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message({ showClose: true, type: 'error', message: '分摊比例不能为空' }) |
||||
|
} |
||||
|
}, |
||||
|
doClose() { |
||||
|
this.$store.dispatch('tagsView/delView', this.$route) |
||||
|
this.$router.go(-1) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped> |
||||
|
/*表格列设置fixed后固定列出现下边框的设置*/ |
||||
|
/deep/ .el-table__fixed { |
||||
|
height: 100% !important; |
||||
|
} |
||||
|
/*表格列设置fixed后固定列出现下边框的设置*/ |
||||
|
/deep/ .el-table__fixed-right { |
||||
|
height: 100% !important; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue