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.
 
 
 
 
 
 

379 lines
12 KiB

<template>
<div class="app-container">
<!--待开票列表页面-->
<div v-show="viewState == 1">
<!--标题按钮部分开始-->
<div class="tab-header webtop">
<!--标题-->
<div>待出库车辆列表</div>
<!--start 查询列表按钮部分开始-->
<div>
<el-button type="primary" size="small" @click="handleCreate()">出库申请</el-button>
</div>
<!--end 查询列表按钮部分结束-->
</div>
<!--按钮部分结束-->
<div class="switch_btn">
<el-button :class="{btn_style:viewState === 1}">待出库车辆列表</el-button>
<el-button class="" @click="handleInvoiceList">出库申请列表</el-button>
</div>
<!--Start查询列表部分-->
<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.contractNo" placeholder="请输入合同编号" clearable class="filter-item"/>
</el-form-item>
<el-form-item label="客户名称">
<el-select v-model="listQuery.name" class="addinputw" clearable filterable
placeholder="请选择" @change="customerChange">
<el-option v-for="item in customerList" :key="item.sid" :label="item.customerName"
:value="item.customerName"/>
</el-select>
</el-form-item>
<el-form-item label="车架号">
<el-input v-model="listQuery.vinNo" placeholder="请输入车架号" clearable class="filter-item"/>
</el-form-item>
<el-divider></el-divider>
<div class="searchbtns">
<el-button type="primary" @click="handleFilter">查询</el-button>
<el-button type="primary" @click="handleReset">重置</el-button>
</div>
</el-form>
</div>
</div>
<!--End查询列表部分-->
<div class="listtop">
<div class="tit">待出库车辆列表</div>
<pageye v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
class="pagination" @pagination="getList"/>
</div>
<!--Start 主页面主要部分 -->
<div class="listcon">
<el-table ref="multipleTable" :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 label="序号" type="index" width="80" :index="indexMethod" align="center"/>
<el-table-column label="认款状态" align="center">
<template slot-scope="scope">
<span>{{ scope.row.type }}</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.vinNo }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="pages">
<div class="tit"/>
<!-- 翻页 -->
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
class="pagination" @pagination="getList"/>
</div>
</div>
<!-- 出库申请新增页面 -->
<chukushenqing-add v-show="viewState == 2" ref="divadd" @doback="resetState"
@reloadlist="getList"/>
<!-- 出库申请列表 -->
<chukushenqing v-show="viewState == 5" ref="divchuku"/>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
import {
listPage,
checkingApply,
typeValues,
customerName,
checkNum
} from '@/api/chukuguanli/chukubanli'
import {setuser, getuser} from '@/utils/baocun'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import chukushenqing from './chukushenqing'
import chukushenqingAdd from './chukushenqingAdd'
export default {
name: 'daichukucheliang',
components: {
Pagination,
pageye,
chukushenqing,
chukushenqingAdd
},
data() {
return {
isSearchShow: false, //主页面:隐藏查询条件按钮
searchxianshitit: '显示查询条件',
viewState: 1, // 1、列表 2、新增 3、编辑 4、查看 5.开票申请
//查询 -----------
tableKey: 0,
infoList: [],
sids: [],// 用于导出的时候保存已选择的SIDs
total: 1,
FormLoading: false,
listLoading: false,
customerList: [],
invoicingNature: 'invoicingNature',
typeList: [], //选择器
list: [],
//翻页
listQuery: {
current: 1,
size: 20,
params: {
contractNo: '', // 合同编号
name: '', // 客户名称
vinNo: '' // 车架号
}
},
textMap: {
update: '编辑',
create: '创建'
},
temp: {},
initObj: {
detailVo: {
applyDate: '', // 申请日期
contractNo: '', // 合同编号
isTerminal: '', // 是否是终端
modelName: '', // 车型别名
name: '', // 客户名称
listVo: [],
},
sid: '',
stringList: []
},
// { // listVo
// price:'', //成交价
// remarks:'', // 备注
// sid:'', //库关联sid
// useMessageSid:'', //使用人sid
// vinNo:'',// 车架号
// },
dialogStatus: ''
}
},
// ------------------------------------
computed: {
...mapGetters(['id', 'roles', 'rolesIds', 'departmentId', 'departmentCode'])
},
created() {
// 初始化变量
this.init()
// 加载列表
this.getList()
},
methods: {
// ========== 初始化加载 ==========
init() {
this.getCustomer()
},
// 客户下拉框
getCustomer() {
customerName().then((response) => {
if (response.code === '200') {
this.customerList = response.data
console.log('客户列表', this.customerList)
}
})
},
// 客户名称
customerChange(value) {
console.log('触发下拉框按钮', value)
let bb = {}
this.typeList.forEach((e) => {
if (e.customerName == value) {
bb = {
name: e.customerName,
sid: e.sid
}
}
})
this.listQuery.params.name = bb.name
console.log('客户名称', this.listQuery.params.name)
},
// ========== 页面按钮功能 ==========
// 搜索条件效果
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
// 表中序号
indexMethod(index) {
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
var pageindex = index + 1 + pagestart
return pageindex
},
//信息条数 获取点击时当前的sid
handleSelectionChange(row) {
console.log('待出库', row)
const aa = [] // sid
const bb = [] // contractNo
const cc = [] // listVo 使用车辆表
var dd = {}
for (var i = 0; i < row.length; i++) {
for (var j = i + 1; j < row.length; j++) {
if (row[i].contractNo !== row[j].contractNo) {
this.$message({
showClose: true,
message: '请选择同一合同编号的车辆!',
type: 'error'
});
// this.$refs.multipleTable.clearSelection();
return
}
}
}
row.forEach(element => {
aa.push(element.sid)
setuser(this.sids) // 用于导出的时候保存已选择的sids
bb.push(element.contractNo)
cc.push({
price: element.price, //成交价
remarks: '', // 备注
sid: '', //库关联sid 可不传
useMessageSid: '', //使用人sid可不传,已默认“无”
vinNo: element.vinNo,//车架号
})
dd = {
applyDate: element.applyDate, // 申请日期
contractNo: element.contractNo, // 合同编号
isTerminal: element.isTerminal, // 是否是终端
modelName: element.modelName, // 车型别名
name: element.name, // 客户名称
}
})
this.sids = aa
this.initObj.stringList = bb
console.log('cc',cc)
this.initObj.detailVo.listVo = cc
this.initObj.detailVo.applyDate = dd.applyDate
this.initObj.detailVo.contractNo = dd.contractNo
this.initObj.detailVo.isTerminal = dd.isTerminal
this.initObj.detailVo.modelName = dd.modelName
this.initObj.detailVo.name = dd.name
console.log('sids:', this.sids, 'this.initObj.stringList', this.initObj.stringList, 'this.initObj', this.initObj)
},
// ========== 业务功能 ==========
handleInvoiceList() {
this.viewState = 5
},
//修改、编辑、详情返回列表页面
resetState() {
this.viewState = 1
},
// 查询按钮
handleFilter() {
this.listQuery.current = 1
this.getList()
},
//点击重置
handleReset() {
this.listQuery.params.vinNo = ''// 单据编号
this.listQuery.params.contractNo = ''// 开票性质
this.listQuery.params.name = '' // 开票名称
},
// 查询列表信息
getList() {
this.listLoading = true
listPage({
current: this.listQuery.current,
size: this.listQuery.size,
params: {
contractNo: this.listQuery.contractNo,
name: this.listQuery.name, //传递参数,
vinNo: this.listQuery.vinNo
}
}).then(response => { //拦截器
this.listLoading = false
console.log(response)
if (response.success && response.data && response.data.total > 0) {
this.list = response.data.records
this.total = response.data.total
} else {
this.list = []
this.total = 0
}
})
},
// 打开新增
handleCreate() {
if (this.sids.length === 0) {
this.$message({showClose: true, type: 'error', message: '请选择一条记录进行出库申请'})
return
}
if (this.sids.length > 0) {
this.FormLoading = true
checkingApply(this.initObj).then(response => {
if (response.success) {
this.viewState = 2
this.temp = response.data
this.$refs['divadd'].showAdd(this.temp)
}
})
}
},
}
}
</script>
<style scoped>
.switch_btn {
padding: 15px 0 10px 0;
}
.btn_style {
background-color: #018ad2;
color: white;
font-weight: 600;
}
/deep/ .el-collapse {
border-top: 0px solid #e6ebf5;
border-bottom: 0px solid #e6ebf5;
}
/deep/ .el-collapse-item__content {
margin: 0;
padding: 0;
}
/deep/ .el-collapse-item__wrap {
border-bottom: 0px solid #ebeef5;
}
/deep/ .el-collapse-item__header {
border-bottom: 0px solid #e6ebf5;
}
.searchbtn {
border: #2cab69 1px solid;
color: #2cab69;
}
.searchli {
padding: 5px 100px;
}
</style>