You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

478 lines
17 KiB

<template>
<div class="app-container">
<div v-show="viewState == 1">
<button-bar view-title="出库开票申请管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
<!--Start查询列表部分-->
<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.paymentMethodKey" class="addinputw" clearable filterable placeholder="请选择">
<el-option v-for="item in payType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
</el-select>
</el-form-item>
<el-form-item label="合同编号">
<el-input v-model="listQuery.params.contractNo" placeholder="" clearable class="filter-item"/>
</el-form-item>
<el-form-item label="客户名称">
<el-input v-model="listQuery.params.name" placeholder="" clearable class="filter-item"/>
</el-form-item>
<el-form-item label="申请日期">
<el-date-picker v-model="listQuery.params.applyDateStart" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" clearable></el-date-picker>
<span style="padding: 0 8px">至</span>
<el-date-picker v-model="listQuery.params.applyDateEnd" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" clearable></el-date-picker>
</el-form-item>
</el-form>
<div class="btn" style="text-align: center;">
<el-button type="primary" icon="el-icon-search" size="small" @click="handleFilter">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" size="small" @click="handleReset">重置</el-button>
</div>
</div>
</div>
<!--End查询列表部分-->
<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>
<!--Start 主页面主要部分 -->
<div class="listcon">
<el-table :key="tableKey" v-loading="listLoading" :data="list" :border="true" fit highlight-current-row style="width: 100%;" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50"/>
<el-table-column fixed label="序号" type="index" width="80" :index="indexMethod" align="center"/>
<el-table-column fixed width="220px" label="操作" align="center">
<template slot-scope="scope">
<el-button size="small" type="danger" :disabled="scope.row.nodeState === '待提交' ? true : scope.row.nodeState === '已办结' ? true : scope.row.nodeState === '已终止' ? true : scope.row.nodeState === '发起申请' ? true : false" @click="handleRevoke(scope.row)">撤回
</el-button>
<el-button size="small" type="primary" :disabled="scope.row.nodeState === '待提交' ? false : scope.row.nodeState === '发起申请' ? false : true" @click="toEdit(scope.row)">办理
</el-button>
<el-button size="small" type="primary" @click="toInfo(scope.row)">查看</el-button>
</template>
</el-table-column>
<el-table-column label="状态" width="180px" header-align="center">
<template slot-scope="scope">
<span v-if="scope.row.nodeState=='待提交'" type="primary" size="mini">待提交</span>
<span v-else @click="flowRecord(scope.row)" class="bluezi">{{ scope.row.nodeState }}</span>
</template>
</el-table-column>
<el-table-column label="单据编号" align="center">
<template slot-scope="scope">
<span>{{ scope.row.billNo }}</span>
</template>
</el-table-column>
<el-table-column label="销售类型" align="center">
<template slot-scope="scope">
<span class="bluezi" v-if="scope.row.paymentMethodKey == '2'" @click="lookQuotation(scope.row)">{{ scope.row.paymentMethod }}</span>
<span v-else>{{ scope.row.paymentMethod }}</span>
</template>
</el-table-column>
<el-table-column label="合同编号" align="center">
<template slot-scope="scope">
<span>{{ scope.row.contractNo }}</span>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="车型" align="center">
<template slot-scope="scope">
<span>{{ scope.row.modelName }}</span>
</template>
</el-table-column>
<el-table-column label="台数" align="center">
<template slot-scope="scope">
<span>{{ scope.row.num }}</span>
</template>
</el-table-column>
<el-table-column label="发起日期" align="center">
<template slot-scope="scope">
<span>{{ scope.row.applyDate }}</span>
</template>
</el-table-column>
<el-table-column label="申请人" align="center">
<template slot-scope="scope">
<span>{{ scope.row.applyName }}</span>
</template>
</el-table-column>
</el-table>
</div>
<!--End 主页面主要部分-->
<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>
<!--End查询列表部分-->
</div>
</div>
<!-- 新增或编辑 -->
<chukushenqing-add v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="getList"/>
<!-- 详情 -->
<chukushenqing-info v-show="viewState == 4" ref="divInfo" @doback="resetState" @reloadlist="getList"/>
<!-- -->
<financialquotationsheet v-show="viewState == 5" ref="divJRBJD" @doback="resetState"/>
<!-- 审批记录 -->
<el-dialog title="" :visible.sync="centerDialogVisible" width="78%" height="1%" :before-close="closeIt" center>
<iframe frameborder="0" id="iframe" style="width:100%;" scrolling="no" :src="this.centerDialogVisible === true ? url :''"></iframe>
</el-dialog>
</div>
</template>
<script>
import { delBySids, pagerList, revokeProcess, ckxstz } from '@/api/chukuguanli/chukubanli'
import { typeValues, selectHaveMessage, getButtonPermissions } from '@/api/dictcommons/dictcommons'
import { getStorage } from '@/utils/auth'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import chukushenqingAdd from './chukushenqingAdd'
import chukushenqingInfo from './chukushenqingInfo'
import financialquotationsheet from './relation/financialquotationsheet'
export default {
name: 'chukushenqing',
components: {
ButtonBar,
Pagination,
pageye,
chukushenqingAdd,
chukushenqingInfo,
financialquotationsheet
},
data() {
return {
url: '',
dialogHeight: '80%',
centerDialogVisible: false,
btndisabled: false,
// 主页面:隐藏查询条件按钮
isSearchShow: false,
searchxianshitit: '显示查询条件',
viewState: 1, // 1、列表 2、新增 3、编辑 4、查看
// 查询 -----------
tableKey: 0,
payType: [],
list: [],
sids: [], // 用于导出的时候保存已选择的SIDs
multipleSelection: [],
FormLoading: false,
listLoading: false,
// 翻页
listQuery: {
current: 1,
size: 10,
total: 0,
params: {
applyDateEnd: '', // 申请日期结束时间
applyDateStart: '', // 申请日期开始时间
applyName: '', // 申请人
applySid: '', // 申请人sid
contractNo: '', // 合同编号
name: '', // 客户名称
paymentMethodKey: '',
menuUrl: '',
orgPath: ''
}
},
btnList: [
{
type: 'primary',
size: 'small',
icon: 'plus',
btnKey: 'toAdd',
btnLabel: '新增'
},
{
type: 'primary',
size: 'small',
icon: '',
btnKey: 'toPush',
btnLabel: '重推'
},
{
type: 'danger',
size: 'small',
icon: 'del',
btnKey: 'doDel',
btnLabel: '删除'
},
{
type: 'info',
size: 'small',
icon: 'cross',
btnKey: 'doClose',
btnLabel: '关闭'
}
]
}
},
created() {
// 初始化变量
this.init()
},
mounted() {
// 在外部vue的window上添加postMessage的监听,而且绑定处理函数handleMessage
window.addEventListener('message', this.handleMessage)
getButtonPermissions({ userSid: window.sessionStorage.getItem('userSid'), url: this.$route.path, type: 0 }).then((res) => {
if (res.success) {
for (var i = 0; i < res.data.length; i++) {
for (var k = 0; k < this.btnList.length; k++) {
if (res.data[i].buttonId === this.btnList[k].btnKey) {
this.btnList.splice(k, 1)
}
}
}
this.$refs['btnbar'].setButtonList(this.btnList)
}
})
},
methods: {
async handleMessage(event) {
var code = ''
if (event.data.params !== null && event.data.params !== undefined) {
code = event.data.params.code
}
if (code === 1) {
this.init()
this.centerDialogVisible = false
} else if (code === 2) {
this.dialogHeight = event.data.params.data
this.setIframeHeight(document.getElementById('iframe'))
}
},
closeIt() {
this.url = ''
this.centerDialogVisible = false
},
setIframeHeight(iframe) {
iframe.height = this.dialogHeight
},
flowRecord(row) {
this.centerDialogVisible = true
var params = {
deployId: row.procDefId,
procInsId: row.procInstId,
token: getStorage()
}
this.url = '/#/flow/flowRecordForBusiness?data=' + encodeURI((JSON.stringify(params)))
},
// ========== 初始化加载 ==========
init() {
typeValues({ type: 'purchaseType' }).then((res) => {
if (res.success) {
this.payType = res.data
}
})
this.getList()
},
btnHandle(btnKey) {
console.log('XXXXXXXXXXXXXXX ' + btnKey)
switch (btnKey) {
case 'toAdd':
this.toAdd()
break
case 'toPush':
this.toPush()
break
case 'doDel':
this.doDel()
break
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
},
// ========== 页面按钮功能 ==========
// 搜索条件效果
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
handleRevoke(row) {
if (row.allowModify) {
this.$confirm('是否确定撤回该业务', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
revokeProcess({ taskId: row.taskId, businessSid: row.sid, instanceId: row.procInstId, userSid: window.sessionStorage.getItem('userSid') }).then((response) => {
if (response.success) {
this.$message({ showClose: true,type: 'success', message: response.msg })
this.getList()
}
})
})
} else {
this.$message({ showClose: true, type: 'error', message: '非本人发起的申请,无权限操作' })
}
},
// 信息条数 获取点击时当前的sid
handleSelectionChange(row) {
const aa = []
this.multipleSelection = row
row.forEach(element => {
aa.push(element.sid)
})
this.sids = aa
console.log('sids数组', this.sids)
},
// ========== 业务功能 ==========
// 查询列表信息
getList() {
this.listLoading = true
this.listQuery.params.applySid = window.sessionStorage.getItem('userSid')
this.listQuery.params.menuUrl = this.$route.path
this.listQuery.params.orgPath = 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 = {
current: 1,
size: 10,
total: 0,
params: {
applyDateEnd: '', // 申请日期结束时间
applyDateStart: '', // 申请日期开始时间
applyName: '', // 申请人
applySid: '', // 申请人sid
contractNo: '', // 合同编号
name: '', // 客户名称
paymentMethodKey: '',
menuUrl: '',
orgPath: ''
}
}
this.getList()
},
toAdd() {
selectHaveMessage({ menuUrl: this.$route.path, orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => {
if (resp.success) {
this.viewState = 2
this.$refs['divadd'].showAdd()
}
})
},
// 办理
toEdit(row) {
if (row.allowModify) {
this.viewState = 3
this.$refs['divadd'].showEdit(row)
} else {
this.$message({ showClose: true, type: 'error', message: '非本人发起的申请,无权限操作' })
}
},
// 打开查看
toInfo(row) {
this.viewState = 4
this.$refs['divInfo'].showInfo(row.sid)
},
lookQuotation(row) {
this.viewState = 5
this.$refs['divJRBJD'].showInfo(row)
},
// 重推
toPush() {
if (this.sids.length === 1) {
if (this.multipleSelection[0].nodeState === '已办结') {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
ckxstz({ ckSid: this.sids[0] }).then((resp) => {
loading.close()
if (resp.success) {
this.$message({ showClose: true, type: 'success', message: '重推成功' })
this.getList()
}
})
} else {
this.$message({ showClose: true, type: 'error', message: '请选择状态为已办结的记录进行重推操作' })
}
} else {
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行重推操作' })
}
},
// 删除
doDel() {
if (this.sids.length === 0) {
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' })
return
}
for (var i = 0; i < this.multipleSelection.length; i++) {
if (!this.multipleSelection[i].allowModify) {
this.$message({ showClose: true, type: 'error', message: '非本人发起的申请,无权限操作' })
return
}
}
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
delBySids(this.sids).then((resp) => {
loading.close()
if (resp.success) {
this.$message({ type: 'success', message: resp.msg, showClose: true })
this.getList()
}
}).catch(e => {
loading.close()
})
}).catch(() => {
})
},
// 编辑、详情返回列表页面
resetState() {
this.viewState = 1
},
// 关闭
doClose() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.go(-1)
}
}
}
</script>
<style scoped>
</style>