|
|
@ -1,79 +1,193 @@ |
|
|
|
<template> |
|
|
|
<div class="app-container"> |
|
|
|
<el-form ref="queryForm" :model="queryParams" :inline="true"> |
|
|
|
<el-form ref="queryForm" |
|
|
|
:model="queryParams" |
|
|
|
:inline="true"> |
|
|
|
<el-form-item label="申请日期"> |
|
|
|
<el-date-picker |
|
|
|
v-model="queryParams.requesttime" |
|
|
|
type="date" |
|
|
|
placeholder="选择日期" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
style="width:135px" |
|
|
|
/> |
|
|
|
<el-date-picker v-model="queryParams.requesttime" |
|
|
|
type="date" |
|
|
|
placeholder="选择日期" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
style="width:135px" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="申请类型" |
|
|
|
v-if="roles.includes('admin') || roles.includes('pm') || roles.includes('topm')"> |
|
|
|
<el-select v-model="queryParams.reqtype" |
|
|
|
placeholder="请选择" |
|
|
|
@change="changeType"> |
|
|
|
<el-option v-for="item in typeList" |
|
|
|
:key="item.value" |
|
|
|
:label="item.name" |
|
|
|
:value="item.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
icon="el-icon-search" |
|
|
|
size="mini" |
|
|
|
@click="handleQuery">搜索</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table v-loading="loading" :data="dataList" border> |
|
|
|
<el-table v-loading="loading" |
|
|
|
:data="dataList" |
|
|
|
border> |
|
|
|
<el-table-column type="expand"> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<el-table v-if="(row.detail || []).length > 0" :data="row.detail" border> |
|
|
|
<el-table-column label="票据" align="center" width="120"> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<div style="height:40px; over-flow:hidden"> |
|
|
|
<viewer :images="row.picpath.split(',')"> |
|
|
|
<!-- :images一定要一个数组,否则报错 --> |
|
|
|
<img |
|
|
|
v-for="(src,index) in row.picpath.split(',')" |
|
|
|
:key="index" |
|
|
|
:src="baseUrl + '/' + src" |
|
|
|
width="40px" |
|
|
|
height="35px" |
|
|
|
style="over-flow:hidden; margin-left:5px" |
|
|
|
> |
|
|
|
</viewer> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('requester')" prop="requester" align="center" show-overflow-tooltip width="120" /> |
|
|
|
<el-table-column :label="getColumnName('agentman')" prop="agentman" align="center" show-overflow-tooltip width="120" /> |
|
|
|
<el-table-column :label="getColumnName('approvaltype')" prop="approvaltype" width="120" align="center" show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('subject')" prop="subject" width="120" align="center" show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('money')" prop="money" width="100" align="center" show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('requesttime')" align="center" width="160"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['requesttime']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('lastmodif')" align="center" width="154"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['lastmodif']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('lastuser')" prop="lastuser" width="130" align="center" /> |
|
|
|
<el-table v-if="(row.detail || []).length > 0" |
|
|
|
:data="row.detail" |
|
|
|
border> |
|
|
|
<template v-if="queryParams.reqtype == 0"> |
|
|
|
|
|
|
|
<el-table-column label="票据" |
|
|
|
align="center" |
|
|
|
width="120"> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<div style="height:40px; over-flow:hidden"> |
|
|
|
<viewer :images="row.picpath.split(',')"> |
|
|
|
<!-- :images一定要一个数组,否则报错 --> |
|
|
|
<img v-for="(src,index) in row.picpath.split(',')" |
|
|
|
:key="index" |
|
|
|
:src="baseUrl + '/' + src" |
|
|
|
width="40px" |
|
|
|
height="35px" |
|
|
|
style="over-flow:hidden; margin-left:5px"> |
|
|
|
</viewer> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('requester')" |
|
|
|
prop="requester" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip |
|
|
|
width="120" /> |
|
|
|
<el-table-column :label="getColumnName('agentman')" |
|
|
|
prop="agentman" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip |
|
|
|
width="120" /> |
|
|
|
<el-table-column :label="getColumnName('approvaltype')" |
|
|
|
prop="approvaltype" |
|
|
|
width="120" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('subject')" |
|
|
|
prop="subject" |
|
|
|
width="120" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('money')" |
|
|
|
prop="money" |
|
|
|
width="100" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('requesttime')" |
|
|
|
align="center" |
|
|
|
width="160"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['requesttime']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('lastmodif')" |
|
|
|
align="center" |
|
|
|
width="154"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['lastmodif']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('lastuser')" |
|
|
|
prop="lastuser" |
|
|
|
width="130" |
|
|
|
align="center" /> |
|
|
|
</template> |
|
|
|
<template v-if="queryParams.reqtype == 1"> |
|
|
|
|
|
|
|
<el-table-column :label="getColumnName('requester')" |
|
|
|
prop="requester" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip |
|
|
|
width="120" /> |
|
|
|
<el-table-column :label="getColumnName('approvaltype')" |
|
|
|
prop="approvaltype" |
|
|
|
width="120" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('requestinfo')" |
|
|
|
prop="requestinfo" |
|
|
|
width="120" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('qty')" |
|
|
|
prop="qty" |
|
|
|
width="120" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('purpose')" |
|
|
|
prop="purpose" |
|
|
|
width="100" |
|
|
|
align="center" |
|
|
|
show-overflow-tooltip /> |
|
|
|
<el-table-column :label="getColumnName('requesttime')" |
|
|
|
align="center" |
|
|
|
width="160"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['requesttime']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('lastmodif')" |
|
|
|
align="center" |
|
|
|
width="154"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ parseTime(scope.row['lastmodif']) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</template> |
|
|
|
</el-table> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="票据" align="center" width="120"> |
|
|
|
<el-table-column v-if="roles.includes('finance') || roles.includes('CFO') || roles.includes('accounting') || roles.includes('FM') || roles.includes('admin') && queryParams.reqtype == 0 || roles.includes('pm') && queryParams.reqtype == 0 || roles.includes('topm') && queryParams.reqtype == 0 " |
|
|
|
label="票据" |
|
|
|
align="center" |
|
|
|
width="120"> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<div style="height:40px; over-flow:hidden"> |
|
|
|
<viewer :images="row.picpath.split(',')"> |
|
|
|
<!-- :images一定要一个数组,否则报错 --> |
|
|
|
<img v-for="(src,index) in row.picpath.split(',')" |
|
|
|
:key="index" |
|
|
|
:src="baseUrl + '/' + src" |
|
|
|
width="40px" |
|
|
|
height="35px" |
|
|
|
style="over-flow:hidden; margin-left:5px"> |
|
|
|
</viewer> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="roles.includes('buyer') || roles.includes('admin') && queryParams.reqtype == 1 || roles.includes('pm') && queryParams.reqtype == 1 || roles.includes('topm') && queryParams.reqtype == 1 " |
|
|
|
label="清单" |
|
|
|
align="center" |
|
|
|
width="120"> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<div style="height:40px; over-flow:hidden"> |
|
|
|
<viewer :images="row.picpath.split(',')"> |
|
|
|
<!-- :images一定要一个数组,否则报错 --> |
|
|
|
<img |
|
|
|
v-for="(src,index) in row.picpath.split(',')" |
|
|
|
:key="index" |
|
|
|
:src="baseUrl + '/' + src" |
|
|
|
width="40px" |
|
|
|
height="35px" |
|
|
|
style="over-flow:hidden; margin-left:5px" |
|
|
|
> |
|
|
|
<img v-for="(src,index) in row.picpath.split(',')" |
|
|
|
:key="index" |
|
|
|
:src="baseUrl + '/' + src" |
|
|
|
width="40px" |
|
|
|
height="35px" |
|
|
|
style="over-flow:hidden; margin-left:5px"> |
|
|
|
</viewer> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-for="(item, index) in headers" :key="index" align="center" :label="getColumnName(item)" width="160px" :show-overflow-tooltip="true"> |
|
|
|
<el-table-column v-for="(item, index) in headers" |
|
|
|
:key="index" |
|
|
|
align="center" |
|
|
|
:label="getColumnName(item)" |
|
|
|
width="160px" |
|
|
|
:show-overflow-tooltip="true"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-if="item === 'cid'">{{ getValue(scope.row[item]) }}</span> |
|
|
|
<span v-else-if="item === 'approvestatus'">{{ filterContent(scope.row['approvestatus'], 'approvestatus') }}</span> |
|
|
@ -81,33 +195,36 @@ |
|
|
|
<span v-else>{{ scope.row[item] }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column :label="getColumnName('Operation')" align="center" fixed="right" width="120"> |
|
|
|
<el-table-column :label="getColumnName('Operation')" |
|
|
|
align="center" |
|
|
|
fixed="right" |
|
|
|
width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button |
|
|
|
size="mini" |
|
|
|
type="text" |
|
|
|
@click="handleApproval(scope.row, 1)" |
|
|
|
>通过</el-button> |
|
|
|
<el-button |
|
|
|
size="mini" |
|
|
|
type="text" |
|
|
|
style="color: red" |
|
|
|
@click="handleApproval(scope.row, 2)" |
|
|
|
>拒绝</el-button> |
|
|
|
<el-button size="mini" |
|
|
|
type="text" |
|
|
|
@click="handleApproval(scope.row, 1)">通过</el-button> |
|
|
|
<el-button size="mini" |
|
|
|
type="text" |
|
|
|
style="color: red" |
|
|
|
@click="handleApproval(scope.row, 2)">拒绝</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<pagination |
|
|
|
v-show="total>0" |
|
|
|
:total="total" |
|
|
|
:page.sync="queryParams.pageIndex" |
|
|
|
:limit.sync="queryParams.pageSize" |
|
|
|
@pagination="getList" |
|
|
|
/> |
|
|
|
<el-dialog title="拒绝原因" :visible.sync="open" width="600px"> |
|
|
|
<el-input v-model="reason" type="textarea" placeholder="请输入..." /> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
<pagination v-show="total>0" |
|
|
|
:total="total" |
|
|
|
:page.sync="queryParams.pageIndex" |
|
|
|
:limit.sync="queryParams.pageSize" |
|
|
|
@pagination="getList" /> |
|
|
|
<el-dialog title="拒绝原因" |
|
|
|
:visible.sync="open" |
|
|
|
width="600px"> |
|
|
|
<el-input v-model="reason" |
|
|
|
type="textarea" |
|
|
|
placeholder="请输入..." /> |
|
|
|
<div slot="footer" |
|
|
|
class="dialog-footer"> |
|
|
|
<el-button type="primary" |
|
|
|
@click="submit">确 定</el-button> |
|
|
|
<el-button @click="open = false">取 消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
@ -132,6 +249,7 @@ export default { |
|
|
|
reason: '', |
|
|
|
// 查询参数 |
|
|
|
queryParams: { |
|
|
|
reqtype: 0, |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 10, |
|
|
|
requesttime: undefined |
|
|
@ -147,25 +265,112 @@ export default { |
|
|
|
{ id: 2, descr: '拒绝' } |
|
|
|
], |
|
|
|
row: {}, |
|
|
|
baseUrl: process.env.VUE_APP_BASE_API |
|
|
|
baseUrl: process.env.VUE_APP_BASE_API, |
|
|
|
roles: [], |
|
|
|
typeList: [ |
|
|
|
{ |
|
|
|
name: '报销', |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '采购', |
|
|
|
value: 1 |
|
|
|
} |
|
|
|
], |
|
|
|
type: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.roles = this.$store.state.user.roles |
|
|
|
if ( |
|
|
|
this.roles.includes('pm') || |
|
|
|
this.roles.includes('topm') || |
|
|
|
this.roles.includes('admin') || |
|
|
|
this.roles.includes('finance') || |
|
|
|
this.roles.includes('CFO') || |
|
|
|
this.roles.includes('FM') || |
|
|
|
this.roles.includes('accounting') |
|
|
|
) { |
|
|
|
this.queryParams.reqtype = 0 |
|
|
|
} else { |
|
|
|
this.queryParams.reqtype = 1 |
|
|
|
} |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
changeType(e) { |
|
|
|
this.queryParams.reqtype = e |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
/** 查询角色列表 */ |
|
|
|
getList() { |
|
|
|
this.loading = true |
|
|
|
getApprovalList(this.queryParams).then( |
|
|
|
response => { |
|
|
|
this.dataList = response.data.data |
|
|
|
this.total = response.data.count |
|
|
|
this.headers = ['cid', 'requester', 'agentman', 'requesttime', 'money', 'approvestatus', 'approvaltype', 'subject', 'status'] |
|
|
|
// this.headers = Object.keys(this.dataList[0] || []).filter(item => item !== 'approvalrequestid' && item !== 'approvalmodelid' && item !== 'callbackfunc') |
|
|
|
this.loading = false |
|
|
|
if ( |
|
|
|
this.roles.includes('finance') || |
|
|
|
this.roles.includes('FM') || |
|
|
|
this.roles.includes('accounting') || |
|
|
|
this.roles.includes('CFO') |
|
|
|
) { |
|
|
|
this.headers = [ |
|
|
|
'cid', |
|
|
|
'requester', |
|
|
|
'agentman', |
|
|
|
'requesttime', |
|
|
|
'approvaltype', |
|
|
|
'money', |
|
|
|
'approvestatus', |
|
|
|
'subject', |
|
|
|
'status' |
|
|
|
] |
|
|
|
} else if ( |
|
|
|
this.roles.includes('topm') || |
|
|
|
this.roles.includes('pm') || |
|
|
|
this.roles.includes('admin') |
|
|
|
) { |
|
|
|
if (this.queryParams.reqtype == 0) { |
|
|
|
this.headers = [ |
|
|
|
'cid', |
|
|
|
'requester', |
|
|
|
'agentman', |
|
|
|
'requesttime', |
|
|
|
'approvaltype', |
|
|
|
'money', |
|
|
|
'approvestatus', |
|
|
|
'subject', |
|
|
|
'status' |
|
|
|
] |
|
|
|
} else { |
|
|
|
this.headers = [ |
|
|
|
'cid', |
|
|
|
'requester', |
|
|
|
'requesttime', |
|
|
|
'approvaltype', |
|
|
|
'qty', |
|
|
|
'requestinfo', |
|
|
|
'purpose', |
|
|
|
'approvestatus', |
|
|
|
'status' |
|
|
|
] |
|
|
|
} |
|
|
|
) |
|
|
|
} else if (this.roles.includes('buyer')) { |
|
|
|
this.headers = [ |
|
|
|
'cid', |
|
|
|
'requester', |
|
|
|
'requesttime', |
|
|
|
'approvaltype', |
|
|
|
'qty', |
|
|
|
'requestinfo', |
|
|
|
'purpose', |
|
|
|
'approvestatus', |
|
|
|
'status' |
|
|
|
] |
|
|
|
} |
|
|
|
getApprovalList(this.queryParams).then((response) => { |
|
|
|
this.dataList = response.data.data |
|
|
|
this.total = response.data.count |
|
|
|
// this.headers = Object.keys(this.dataList[0] || []).filter(item => item !== 'approvalrequestid' && item !== 'approvalmodelid' && item !== 'callbackfunc') |
|
|
|
this.loading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleApproval(row, arg) { |
|
|
|
this.row = row |
|
|
@ -174,17 +379,20 @@ export default { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(function() { |
|
|
|
return commitApproval({ |
|
|
|
approvalrequestid: row['approvalrequestid'], |
|
|
|
approvalstatus: arg, |
|
|
|
approvalmodelid: row['approvalmodelid'], |
|
|
|
approvallevel: row['approvallevel'] |
|
|
|
}) |
|
|
|
.then(function () { |
|
|
|
return commitApproval({ |
|
|
|
approvalrequestid: row['approvalrequestid'], |
|
|
|
approvalstatus: arg, |
|
|
|
approvalmodelid: row['approvalmodelid'], |
|
|
|
approvallevel: row['approvallevel'] |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
this.getList() |
|
|
|
this.msgSuccess('审批成功') |
|
|
|
}) |
|
|
|
}).then(() => { |
|
|
|
this.getList() |
|
|
|
this.msgSuccess('审批成功') |
|
|
|
}).catch(function() {}) |
|
|
|
.catch(function () {}) |
|
|
|
} else { |
|
|
|
this.open = true |
|
|
|
} |
|
|
@ -211,7 +419,7 @@ export default { |
|
|
|
let temp |
|
|
|
switch (arg) { |
|
|
|
case 'approvalmodelid': |
|
|
|
this.options.forEach(item => { |
|
|
|
this.options.forEach((item) => { |
|
|
|
if (item.approvalmodelid === data) { |
|
|
|
temp = item.descr |
|
|
|
return temp |
|
|
@ -219,7 +427,7 @@ export default { |
|
|
|
}) |
|
|
|
break |
|
|
|
case 'status': |
|
|
|
this.statusOptions.forEach(item => { |
|
|
|
this.statusOptions.forEach((item) => { |
|
|
|
if (item.id === data) { |
|
|
|
temp = item.descr |
|
|
|
return temp |
|
|
@ -227,7 +435,7 @@ export default { |
|
|
|
}) |
|
|
|
break |
|
|
|
case 'approvestatus': |
|
|
|
this.resultStatus.forEach(item => { |
|
|
|
this.resultStatus.forEach((item) => { |
|
|
|
if (item.id === data) { |
|
|
|
temp = item.descr |
|
|
|
return temp |
|
|
|